WebRelay Users Manual
5.3.4 Read Coils - Modbus Function Code 01 (0x01)
Read the state of the relay coil. In addition, the optically-isolated digital input can be read using this
function which allows the full state of the WebRelay to be read in a single transaction.
Request
Start Address: 0x0000 or 0x0001
Coil Quantity: 0x0001 or 0x0002
Both Outputs may be read at the same time by specifying the correct starting address and quantity of
coils to be read.
Valid Starting Address and Quantity of coils combinations
Starting address 0x0000 quantity of coils 0x0001 (read relay state only)
Starting address 0x0000 quantity of coils 0x0002 (read relay state and input state)
Starting address 0x0001 quantity of coils 0x0001 (read input state only)
Starting address 0x0001 quantity of coils 0x0002 (not valid)
Response
The WebRelay will respond to the request with a data field of one byte, each bit representing the coil
status. A '
1
' indicates the Output is
ON
. A '
0
' indicates that the Output is
OFF
.
Coil State Byte
Bit 7
6
5
4
3
2
1
Bit 0
x
x
x
x
x
x
input state
relay state
Errors
The sum of the start address and coil count cannot exceed the maximum coil count or an error response
will be returned.
The following are possible error responses:
Coil Read Error Function Code (1 byte): 0x81
Exception Codes (1 byte):
0x01 – Function code not supported.
0x02 – Incorrect combination of start address and quantity of Relays
Xytronix Research & Design, Inc.
Page 65