Modbus/TCP & Modbus RTU Function Codes
Function Code 01 – Read Digital Output Status
20 HC900 Process Controller Communications User Guide Revision 13
April 2017
4.3 Function Code 01 – Read Digital Output Status
Description
Function code 01 (0X references) is used to read a digital output’s ON/OFF status of the HC900 using 16
bit addressing for DO access and data is returned in a binary format mapped into bytes.
The Modbus Comm Digital I/O Channel-to-address mapping is shown starting on page 26.
Broadcast is not supported.
Query
The query message specifies the starting Digital Output (DO) and the quantity of DOs to read. The DO
address in the message is based on the rack slot and channel number of the digital output being read.
Example Query: Read DO channels 1 to 16, located in Rack #1, Slot #1; from the controller with slave
address 1.
Query message format for function code 01
Slave
Address
(00 for TCP)
Response
The DO status in the response message is packed as one DO per bit of the data field. Status is indicated as:
1 = ON; 0 = OFF. The LSB of the first data byte contains the DO addressed in the query. The other DOs
follow toward the high order end of this byte, and from low order to high order in subsequent bytes.
If the returned DO quantity is not a multiple of eight, the remaining bits in the final data byte will be padded
with zeros (toward the high order end of the byte). The byte count field specifies the quantity of data bytes
returned.
Example Response: DO channels 2 and 6 located in Rack #1, Slot #1 are on; all others are off.
Response message format for function code 01
Slave
Address
(00 for TCP)
In the response the status of DOs 1 - 8 is shown as the byte value 22 hex, or 0010 0010 binary. DO 8 is the
MSB of this byte, and DO 1 is the LSB. Left to right, the status of DO 8 through 1 is: OFF-OFF-ON-OFF-
OFF-OFF-ON-OFF. The status of DOs 9 - 16 are shown a 00hex, or 0000 0000 with the same bit ordering.