D-Link DE-805TP - 10Mbps Ethernet Mini Hub User Manual Page 14

  • Download
  • Add to my manuals
  • Print
  • Page
    / 77
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 13
Modbus for Field Technicians
Page 14
6. BYTE/WORD ORDER AN AMBIGUOUS NIGHTMARE
It takes two bytes to make a 16 bit word. These bytes can be arranged in two
ways.
When floating point, long integer or MK10 value is transported there are 4
bytes in two words. The order in which the words are sent as well as the
order in which the bytes are packed into each word can change from device
to device.
How did this stupid situation come to be?
Some microprocessors arrange the bytes in a word in one order and other
microprocessors do it in the opposite order. Some programmers account for
this and take steps for the device to serve its bytes in the standard order but
some manufacturers had bad programmers who did not care and their device
put out data in the wrong order.
Most often you will learn of this issue the hard way – the most common
symptom – the values you see in the client are not what you expect.
The jargon word for the order in which bytes are packed into a word is
‘Endianess’.
Here is an example of how this works.
Each block represents one byte. The two bytes make a word. The value in
each block is in decimal.
1 2
This can be interpreted as
1x256 + 2 = 258 (High Order or Most Significant Byte 1
st
)
1 + 2x256 = 513
Page view 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 76 77

Comments to this Manuals

No comments