I have a challenge to talk to a modem using a 'binary protocol' rather than AT commands.. The challenge is to send it commands and hear back what the answer is. My code is not returning the right results..

The instructions say this:

"Commands can be queried for their current value by sending the command logically ORed with the value 0x80 (hexadecimal) "

So for example, to send a command for RSSI, this is known to be:

0X1C hex, (28d) - the response is a hex value from 0x06 to 0x36 indicating signal strenght. This needs to be rolled into a select statement to tell folks if it is excellent (0x36) or really bad (0x06)

So in theory if I send the command 0x1C it will respond with a 1 byte value corresponding to the RSSI. Ive been told that 28d = 156d if xored with 0x80, but I am not sure how to do that ;-). So -

My routine is as follows:

high CMDpin
Serout2 Cpinout,84,[DEC 156]
Serin2 Cpinin,84,1000,noradio,[RSSIB]
pause 10
low CMDpin
LCDout $fe, L4," Strength: ",#RSSIB

Problem is the return value is wrong.. It is more like a 2 143 or a zero or some odd number.. I've also tried

Serin2 Cpinin,84,1000,noradio,[HEX RSSIB]

and this is always '0'

Arggg...

TG