Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:05 18 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Hex code help

Author Message
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 01:14pm 19 May 2016
Copy link to clipboard 
Print this post

I'm wondering if one of you HEX experts can help me out. I'm configuring a radio module and I need some help. I can change the settings and receive the "OK" response. What I need help with is reading back 16 hex bytes of the current settings to double check the settings are there.

Here is what I'm looking for.

Reading the current Config parameter, no parameter follows AA FA E1 16 bytes: (following the order below)

working frequency-4 bytes,
wireless data rate-4 bytes,
receiving bandwidth-2 bytes,
frequency deviation-1 byte,
transmission power-1 byte,
UART transfer speed-4 bytes

could someone finish this code so I can read the 16 bytes? I can't figure it out.


open "com1:9600" as #1
print #1,CHR$(&HAA) + CHR$(&HFA) + CHR$(&HF0) ' set to default values
Do:LOOP until LOC(#1)<>0
pause 500 'Allow data to arrive
S$=INPUT$(LOC(#1),#1)
print "MODULE RESPONSE = "; S$
Pause 500
print #1,CHR$(&HAA) + CHR$(&HFA) + CHR$(&HC3) + CHR$(&H00)+ CHR$(&H00)+ CHR$(&H04)+ CHR$(&HB0)' data rate 1200
Do:LOOP until LOC(#1)<>0
pause 500 'Allow data to arrive
S$=INPUT$(LOC(#1),#1)
print "MODULE RESPONSE = "; S$
print #1,CHR$(&HAA) + CHR$(&HFA) + CHR$(&HE1) ' check settings
Do:LOOP until LOC(#1)<>0
pause 500 'Allow data to arrive
S$=INPUT$(LOC(#1),#1)
PRINT LEN(S$)'shows 16
print "MODULE RESPONSE = "; S$ ' need help to see values


thanks!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1099
Posted: 01:59pm 19 May 2016
Copy link to clipboard 
Print this post

Hi Keith,

What does the last line of your program above print?

Doug.

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:04pm 19 May 2016
Copy link to clipboard 
Print this post

Maybe you could do something like this and put each byte received into its own array location. Then you could read whatever bytes you wanted. I'm no expert...

DIM RECBYTE(16) 'Add this somewhere on top
FOR A = 1 TO 16
S$ = INPUT$(1, #1)
RECBYTE(A) = HEX$(ASC(S$))
NEXT A

Then RECBYTE(1) thru RECBYTE(4) would be the working freq. etc, etc...

Just a thought


Sent from my iPhone 6

 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1099
Posted: 02:14pm 19 May 2016
Copy link to clipboard 
Print this post

Keith,

The following will print out the hex equivalent of the 16 bytes in your s$

Cheers,
Doug.


s$="0123456789abcdef"
for slen = 1 to len(s$)
print hex$(ASC(mid$(s$,slen,1)))
next slen

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 02:39pm 19 May 2016
Copy link to clipboard 
Print this post

Thanks for the quick help!

ViacomJim I get the following with your code. RECBYTE(A) = HEX$(ASC(S$)) error expected a number.

Panky with your code I get 15 numbers
31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 not sure what that means?

 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:49pm 19 May 2016
Copy link to clipboard 
Print this post

I'm not by my setup for testing so I can't check, but maybe give this a whirl...

DIM RECBYTE$(16)

and change to

RECBYTE$(A) = HEX$(ASC(S$))

Sent from my iPhone 6

Not sure if this will work but give it a try.
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 03:05pm 19 May 2016
Copy link to clipboard 
Print this post

It gave me the number 16.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1099
Posted: 04:04pm 19 May 2016
Copy link to clipboard 
Print this post

Keith,

I just put in 16 bytes of sample data into S$ - it returned the hex values for the ASCII characters 0 thru 9 and A thru F just as a test.

If you omit the S$= ..... from the first line of my code then replace your bottom most statement (the Print statement) with the rest of my code it will print out the hex values for the 16 bytes of data that is in S$ that you collected in the statements above.

Cheers,
Doug.
Edited by panky 2016-05-21
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 08:13pm 19 May 2016
Copy link to clipboard 
Print this post

Hi KRZ3,

I think you use an Hope HR-TMP module.
Have you find any possibility, to make a chip full reset?
I made a mistake: mistype the baud-rate modifying command, so
the chip is a brick...

drkl
 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 12:46am 20 May 2016
Copy link to clipboard 
Print this post

Ahhh, I should have realized that Panky. Thanks! I will give it a try tonight and let you know.

Drkl, this is HM-TRP and I'm not sure on the full reset option. I just started using them. I am in talks with Hope on this module so I emailed the rep to see if a full reset is possible without serial com. I will let you know what I find out.

 
KRZ3
Newbie

Joined: 31/12/2014
Location: United States
Posts: 38
Posted: 01:41am 24 May 2016
Copy link to clipboard 
Print this post

Just wanted to follow up with this. First thanks Panky your code worked perfect! I really appreciate the help.

Drkl, I talked with our rep at Hope and they said the only way to reset to default was by software. No hardware reset available on them.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024