Common MODBUS functions • 287
Function code FC5 (Write Coil)
Modular I/O System
ETHERNET TCP/IP
6.2.5
Function code FC5 (Write Coil)
With the aid of this function a single output bit is written.
Request
The request determines the address of the output bit. Addressing starts with 0.
Example: The second output bit is set (address 1):
Byte
Field name
Example
Byte 0, 1
Transaction identifier
0x0000
Byte 2, 3
protocol identifier
0x0000
Byte 4, 5
length field
0x0006
Byte 6
unit identifier
0x01 not used
Byte 7
MODBUS function code
0x05
Byte 8, 9
reference number
0x0001
Byte 10
ON/OFF
0xFF
Byte 11
0x00
Response
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x05
Byte 8, 9
Reference number
0x0001
Byte 10
Value
0xFF
Byte 11
0x00
Exception
Byte
Field name
Example
.....
Byte 7
MODBUS function code
0x85
Byte 8
Exception code
0x01, 0x02 or 0x03