604
9
9 Communication9.4 Modbus Protocol
3) Protocol description
Modbus slave station protocols include the Modbus-RTU protocol (the RTU protocol) and the Modbus-
ASC protocol (the ASC protocol). The data link used through the RTU protocol is different from that used
through the ASC protocol. The data transmitted through the RTU protocol is original data, while the data
transmitted through the ASC protocol has been converted into ASCII codes. In addition, the two protocols
differ in the frame structure. In the RTU protocol, frames are differentiated by time: if no data is received in
3.5 bytes of time, the system determines that all data has been transmitted. In the ASC protocol, ":" is the
starting character and "\CR\LF(0D0Ah)" is the end character of a frame. The efciency of communication
through the RTU approximately doubles that of communication through the ASC protocol. For details, see
documents about standard Modbus protocols, which can be downloaded online.
9.4.3 Modbus Parameter Numbers and Data Addressing
When the H3U PLC serves as a Modbus slave station, it supports parameter numbers of Modbus protocols:
0x01, 0x03, 0x05, 0x06, 0x0f, and 0x10. With these parameter numbers, read-write coils are indicated by M,
S, T, C, X (read-only), and Y variables; registers are indicated by D, T, and C variables.
When accessing (reading or modifying) internal variables of the slave PLC, the Modbus master must
comply with the following denitions of communication command frames and methods of variable
addressing.
1) Modbus frame format (Modbus-RTU)
a) Parameter number 0x01 (01): Reads coils.
Request frame format: slave address + 0x01 + head address of coils + number of coils + CRC code
No.
Denition of Data
(Byte)
Number of
Bytes
Description
1 Slave address 1 The value ranges from 1 to 247, set by D8121.
2
0x01 (parameter
number)
1 The instruction is to read coils.
3
Head address of
coils
2
Upper bits are followed by lower bits. See "Coil
addressing".
4 Number of coils 2 Upper bits are followed by lower bits (N).
5 CRC code 2 Upper bits are followed by lower bits.
Response frame format: slave address + 0x01 + number of bytes + state of coils + CRC code
No.
Denition of Data
(Byte)
Number of
Bytes
Description
1 Slave address 1 The value ranges from 1 to 247, set by D8121.
2
0x01 (parameter
number)
1 The instruction is to read coils.
3 Number of bytes 1 The value is (N + 7)/8.
4 State of coils (N + 7)/8
Eight coils are indicated by one byte. If the last byte
has less than eight bits, enter 0 for undened bits.
The rst eight coils are indicated by the rst byte,
and the coil with the smallest address is indicated
by the least signicant bit.
5 CRC code 2 Upper bits are followed by lower bits.