Chapter 5 Protocols of Various Services
30
(c) Error
Classification
Size
Range
Function code
1 byte
0x84 (Function code + 0x80)
Exception code
1 byte
0x01,0x02,0x03,0x04
[Table 5-27] Function code 0x04 error frame
(d) Examples
Request frame
Response frame
Classification
HEX
Classification
HEX
Function code
0x04
Function code
0x04
Start address (Upper byte)
0x00
Number of bytes
0x02
Start address (Lower byte)
0x08
Word status (108)
0x00
Number of words (Upper byte)
0x00
Word status (108)
0x0A
Number of words (Lower byte)
0x01
[Table 5-28] Function code 0x04 frame examples
(5) Function code 0x05: Write Single Coil
(a) Request
Classification
Size
Range
Function code
1 byte
0x05
Start address
2 bytes
0x0000 ~ 0xFFFF
Input value
2 bytes
0x0000 or 0xFF0D
[Table 5-29] Function code 0x05 request frame
(b) Response
Classification
Size
Range
Function code
1 byte
0x05
Number of bytes 2 bytes
0x0000 ~ 0xFFFF
Input status
2 bytes
0x0000 or 0xFF00
[Table 5-30] Function code 0x05 response frame
(c) Error
Classification
Size
Range
Function code
1 byte
0x85 (Function code + 0x80)
Exception code
1 byte
0x01,0x02,0x03,0x04
[Table 5-31] Function code 0x05 error 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-32] Function code 0x05 frame examples