serout - Format question

Jeff Haas

Senior Member
I can't find this answer in Manual 2 on the Serout command.

I'm working with the Tenda TDB830 module and moving my code from the 08M to the 08M2. How do you format the serout command to send a hex string?

Is it just:
Serout C.0,T4800,(0xEF) 'Stop Tenda module

Jeff
 

srnet

Senior Member
There is no formatting option to send a byte as a hex string, so it wont be found in the manual.

You need to convert the byte into two ASCII characters first, and send those and the "0x" out via serout.
 

hippy

Technical Support
Staff member
I'm working with the Tenda TDB830 module and moving my code from the 08M to the 08M2. How do you format the serout command to send a hex string?

Is it just:
Serout C.0,T4800,(0xEF) 'Stop Tenda module
Most probably "yes" and the 08M2 SEROUT commands would look exactly like the 08M commands you have been using.

The Tenda module does not receive data as "hex strings" but as single command bytes, which can be specified in hex ( 0xEF or $EF ) or decimal ( 239 ), so any of the following should work, assuming pin and baud rate are correct, and 'b13' can be any byte or word variable ...

Serout C.0, T4800, ( 0xEF )
Serout C.0, T4800, ( $EF )
Serout C.0, T4800, ( 239 )

b13 = 0xEF : Serout C.0, T4800, ( b13 )
b13 = $EF : Serout C.0, T4800, ( b13 )
b13 = 239 : Serout C.0, T4800, ( b13 )
 
Top