Friday, June 17, 2016

Hex, dec, bytes, bits,

Good ASCII to decimal converter:  https://www.branah.com/ascii-converter

Understanding hexadecimal, decimal, binary, bytes, and bits

http://www.swarthmore.edu/NatSci/echeeve1/Ref/BinaryMath/NumSys.html

Scroll down to
Hexadecimal, Octal, Bits, Bytes and Words


To convert two hexadecimal bytes to decimal,

 data_dec = data[9] + data[8]*256; where data[9] is the LSB and data[8] is the MSBt.

For example,

0x03 0xFF in two hex bytes equals 1023.  0x03 is the MSB and 0xFF is the LSB.

Try it out:
data = 0xFF+0x03*256

0x03 is read first so it is the MSB and FF is read second and it is the LSB.

No comments:

Post a Comment