Chapter 5 Protocols of Various Services
27
5.3.3 MBAP Header structure
Classification
Size
Description
Client
Server
Transaction
Identifier
2 bytes
MODBUS Request/
Response treatment
Initializing
Response repeatedly if server
responses
2 bytes
0 = MODBUS protocol
Initializing
Reproducing it from request frame
if server responses
Protocol Identifier
2 bytes
Frame size except
MBAP
Making (If requested) Server makes it (If it responses)
Unit Identifier
1byte
Classification of unit
which connected to
serial line
Initializing
Reproducing it from request frame
if server responses
[Table 5-11] MBAP Header structure
5.3.4 Available function code
Classification
Function
Modbus mark
Function Code 01 (0x01)
Read output bit
Read Coils
Function Code 02 (0x02)
Read input bit
Read Discrete Inputs
Function Code 03 (0x03)
Read output word
Read Holding Registers
Function Code 04 (0x04)
Read input word
Write Input Register
Function Code 05 (0x05)
Write output bit
Write single Coil
Function Code 15 (0x0F)
Continuously write output bit
Write Multiple Coils
Function Code 16 (0x10)
Continuously write output word
Write Multiple Registers
[Table 5-12] Available function code
5.3.5 Frame structure by function code
(1) Function code 0x01: Read Coils
(a) Request
Classification
Size
Range
Function code
1 byte
0x01
Start address
2 bytes
0x0000 ~ 0xFFFF
Number of coils
2 bytes
0x0001 ~ 0x07D0 (2000 bits)
[Table 5-13] Function code 0x01 request frame
(b) Response
Classification
Size
Range
Function code
1 byte
0x01
Number of bytes 2 bytes
N
Coil status
n byte
n = N or N + 1
[Table 5-14] Function code 0x01 response frame