5-33
(3) Handling integer-precision binary data
Integer-precision binary data is used as <ARBITRARY BLOCK>-type transfer data, whether it is program
data or response data, and has the specifications summarized below. Negative values are processed as two’s
complements.
Number of transfer bytes
Byte transfer order
Signed binary code
Unsigned binary code
1, 2, 4, or 8 bytes
Bytes are transferred sequentially, starting at the most significant byte.
LSD ········· Right-justify
MSB ········ Sign bit
When the data length is shorter than the field length, pad the remaining field with MSBs.
LSD ········· Right-justify
MSB ········ Not a sign bit
Pad unused high-order bits with 0s.
Ranges of signed and unsigned 1-byte (8-bit) and 2-byte (16-bit) integer data are shown below.
8-Bit Binary With Sign No Sign
10000000 –128 128
10000001 –172 129
10000010 –126 130
11111101 –3 253
11111110 –2 254
11111111 –1 255
00000000 0 0
00000001 1 1
00000010 2 2
00000011 3 3
01111101 125 125
01111110 126 126
01111111 127 127
16-Bit Binary With Sign No Sign
1000000000000000 –32768 32768
1000000000000001 –32767 32769
1000000000000010 –32766 32770
1111111111111101 –3 65533
1111111111111110 –2 65534
1111111111111111 –1 65535
0000000000000000 0 0
0000000000000001 1 1
0000000000000010 2 2
0000000000000011 3 3
0111111111111101 32765 32765
0111111111111110 32766 37266
0111111111111111 32767 32767
Internal representations of signed 1-, 2-, 3-, 4-, and 8-byte integer data are shown below. When the sign bit is
0, it indicates positive data. When a sign bit is 1, it indicates negative data.
(Integer part)
7
7
0
1 bytes 2 bytes 3 bytes 4 bytes
1 bytes 2 bytes
1 bytes 2 bytes
3 bytes 4 bytes
5 bytes 6 bytes 7 bytes 8 bytes
015 14 8
7015162324313239404748555663 8
701516232431 8
(Integer part)
(Integer part)
(Integer part)
Decimal point
Decimal point
Decimal point
Decimal point
The decimal point position is fixed at the right of the LSB bit,
these data are also called fixed-point binary numbers. As the
decimal point position is fixed, digits below the decimal point
are discarded if an attempt is made to set data containing these
digits (below the decimal point), that is, integer data is set in
the integer part. For unsigned data, all bits are set in the
integer part.
Sign Sign Sign Sign
5.3 Program Data Format