Chapter 2 Basic Unit Specification
3. Communication ports
2-15
B.
05H write a single coil
Function
Code
05H
Function
This function code is used to write a single output to either ON or OFF in
a remote device.
Format
PC
Æ
PLC
PLC
Æ
PC(OK) PLC
Æ
PC(ERROR)
Slave Address
01H
Slave Address 01H
Slave
Address
01H
Function Code
05H
Function Code
05H
Function Code 85H
High 01H
High
01H
Exception
Code
02H
Coil
Address
Low ACH
Coil
Address
Low ACH
Low C2H
High FFH
High FFH
CRC-16
High 94H
Data
Coil
Value
Low 00H
Data
Coil
Value
Low
00H
Low 4FH
Low
4FH
CRC-16
High 77H
CRC-16
High
77H
Remark
A value of 0xFF00 requests the coil to be ON.
A value of 0x0000 requests the coil to be OFF.
C.
0FH Write multiple coils:
Function
Code
0FH
Function
This function code is used to force each coil in a sequence of coils (from 1 to 1968)
to either ON or OFF in a remote device.
Format
PC
Æ
PLC
PLC
Æ
PC(OK)
PLC
Æ
PC(ERROR)
Slave Address
11 H
Slave Address 01H
Slave
Address
01H
Function Code
0FH
Function Code 0FH
Function Code 8FH
High 00H
High 00H
Exception
Code
01H
Start
Address
Low 13H
Data
Check
Code
Low 13H
Low 84H
High 00H
00H
CRC-16
High 35H
Coil
number Low 0AH
Data
Low 0AH
Bytes 02H
Low 26H
Data
*Input Data
CRC-16
High 99H
Low XX
CRC-16
High XX
Remark
1. Byte count equals quantity of coils / 8, if the remainder is different of 0, add one.
2. The data length is equal to Bytes. As in the above example, Bytes=2, that is input
data length is 2 bytes.
3. XX represents that the data differs with different input data
4. It is recommended to set the start address equal multiple of 8. It can improve the
program efficiency.