D.4
SEL-587Z Instruction Manual Date Code 20020903
Modbus RTU Communications Protocol
Modbus Commands
Modbus Commands
01h Read Coil
Status Command
Use function code 01h to read the On/Off status of the selected bits (coils).
You may read the status of up to 2000 bits per query. Note that the relay coil
addresses start at 0 (e.g., Coil 1 is located at address zero). The relay returns
8 bits per byte, most significant bit first, with zeroes padded into incomplete
bytes.
To build the response, the relay calculates the number of bytes required to
contain the number of bits requested. If the number of bits requested is not
evenly divisible by eight, the relay adds one more byte to maintain the balance
of bits, padded by zeroes to make an even byte.
The relay responses to errors in the query are shown below:
Please refer to Table D.9 on page D.8 for coil number assignments.
Table D.4 01h Read Coil Status Command
Bytes Field
Requests from the master must have the following format:
1 byte Slave Address
1 byte Function Code (01h)
2 bytes Address of the First Bit
2 bytes Number of Bits to Read
2 bytes CRC-16
A successful response from the slave will have the following format:
1 byte Slave Address
1 byte Function Code (01h)
1 byte Bytes of data (n)
n bytes Data
2 bytes CRC-16
Error Error Code Returned
Communication
Counter Increments
Invalid bit to read Illegal Data Address (02h) Invalid Address
Invalid number of bits to read Illegal Data Value (03h) Illegal Register
Format error Illegal Data Value (03h) Bad Packet Format