I am reverse engineering a protocol used by an embedded device. This protocol message contains an 8-bit field which I believe to represent an integer number.

To analyze the format used to encode such integer, I have captured some messages and the number I can read on the appliance screen.

This is the 8-bit data I have captured and the integer that is encoded.

0001 1001 = 18
0001 0110 = 12
0000 1010 = 21
0000 0011 = 7

Looking at the data, I have realized that to convert the binary number to the corresponding decimal value the following procedure can be applied:

1. Take the lower 4 bits and shift them upwards of one position 
2. Take the rightmost bit of the higher 4 bit, negate it, and OR it with the bits obtained in the first point.

It looks like some kind of value/multiplier scheme, where the higher 4 bits are the multiplier and the lower 4 bits are the value.

The biggest number I have captured is 21, so I don't know the format behaviour for higher numbers the should use more than 5 bits.

The question is, what kind of integer memory representation is this? How will the bits behave for numbers requiring more than 5 bits?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.