Chapter 5 Protocols of Various Services
28
(c) Error
Classification
Size
Range
Function code
1 byte
0x81 (Function code + 0x80)
Exception code
1 byte
0x01,0x02,0x03,0x04
[Table 5-15] Function code 0x01 error frame
(d) Examples
Request frame
Response frame
Classification
HEX
Classification
HEX
Function code
0x01
Function code
0x01
Start address (Upper byte)
0x00
Number of bytes
0x03
Start address (Lower byte)
0x13
Coil status (27-20)
0xCD
Number of coils (Upper byte)
0x00
Coil status (36-28)
0x6B
Number of coils (Lower byte)
0x13
Coil status (38-36)
0x05
[Table 5-16] Function code 0x01 frame examples
(2) Function code 0x02: Read input bit (Read Discrete Inputs)
(a) Request
Classification
Size
Range
Function code
1 byte
0x02
Start address
2 bytes
0x0000 ~ 0xFFFF
Number of input
2 bytes
0x0001 ~ 0x07D0 (2000 bits)
[Table 5-17] Function code 0x02 request frame
(b) Response
Classification
Size
Range
Function code
1 byte
0x01
Number of bytes 2 bytes
N
Input status
N x 1 bytes
-
[Table 5-18] Function code 0x02 response frame
(c) Error
Classification
Size
Range
Function code
1 byte
0x82 (Function code + 0x80)
Exception code
1 bytes
0x01,0x02,0x03,0x04
[Table 5-19] Function code 0x02 response frame
(d) Examples
Request frame
Response frame
Classification
HEX
Classification
HEX
Function code
0x02
Function code
0x01
Start address (Upper byte)
0x00
Number of bytes
0x03
Start address (Lower byte)
0xC4
Coil status (27-20)
0xCD
Input status (Upper byte)
0x00
Coil status (36-28)
0x6B
Number of coils (Lower byte)
0x16
Coil status (38-36)
0x05
[Table 5-20] Function code 0x02 request frame examples