View Single Post
Posts: 8 | Thanked: 0 times | Joined on Nov 2009
#5
it works in python for unsigned values:

a = 45
b = 51
val = (a<<8) | b
print val >> 8
print val & 0xFF

--
you my add 99 to both a, b before sending, and minus 99 after:

a = -45 + 99
b = -51 + 99
val = (a<<8) | b
print (val >> 8) - 99
print (val & 0xFF) - 99

to avoid negative values

Last edited by mailwl; 2009-11-28 at 13:42.