
11–7Data Encoding
Publication
17706.5.16 - October 1996
A 16-Bit Word in PLC Memory
10 100101 1 1 0 1 1 001
17 16 15 14 13 12 11 10 7 6 5 4 3 2 1 0Bit
(Octal)
Odd, high byte Even, low byte
Value - A576 hex
A 16-Bit Computer Word with Left-to-Right Byte and Bit Order
1010 0 1 1 0 1 1 0 101
15 14 13 12 11 10 9 8 7 6 5 4 3 2Bit
(Decimal)
Odd, high byte Even, low byte
10
10
Value - A576 hex
This figure shows a 16bit computer word with righttoleft byte and bit order (as in DEC PDP11/34 or
VAX 11/780). It also represents a 16bit word in an 8bit processor (such as Zilog Z80 or Intel 8088
microprocessor). If your computer has this type of word order, the conversion is straightforward.
A 16-Bit Computer Word with Right-to-Left Byte and Bit Order
01110110 0 1 0 1 0 010
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Bit
(Octal)
Odd, high byteEven, low byte
Value - A576 hex
(after byte swapping)
This figure shows a 16bit computer word with lefttoright byte and bit order (as in IBM Series 1).
If your computer has this type of word order, the conversion is more complex. You will have to
swap bytes into and out of buffers.
A 16-Bit Computer Word with Left-to-Right Byte Order and
Right-to-Left Bit Order
0111 01 0 1 1 0 0 110
15 14 13 12 11 10 9 8 7 6 5 4 3 2Bit
(Decimal)
Odd, high byteEven, low byte
10
00
Value - A576 hex
(after byte swapping)
This figure shows a 16bit computer word with lefttoright byte order and righttoleft bit order
(as in Zilog Z 8000 or Motorola 68000 microprocessors). If your computer has this type of word
order, your communication driver must handle the task of byte swapping as it loads data into a
buffer. Successive bytes received from the PLC must be stored in the following order:
1,0,3,2,5,4,7,6,9,8. . .
Commentaires sur ces manuels