How do I take a HEX value from -255 to 255 and convert it to a byte from 0 to 255 with another bit of 0 or -1 for the sign? so HEX 81 (-127) is 127 with a sign of 1 and HEX 7F (+127) is 127 with a sign of 0.
Thanks
Printable View
How do I take a HEX value from -255 to 255 and convert it to a byte from 0 to 255 with another bit of 0 or -1 for the sign? so HEX 81 (-127) is 127 with a sign of 1 and HEX 7F (+127) is 127 with a sign of 0.
Thanks
I think its 2.50A PBPro
If you're using 2.50A, and an 18F, then you can use LONG's, which will handle signed integers, both in the math and in the display.
But you want to take a -255 to 255, with a range of 512 integer values, and fit that into a byte value, which has a range of 0 to 255, a total of 256 integer values.
Do you want to lose that 'resolution'? Or do you actually mean something else?