X-600M Users Manual Modbus Operation
5.3.2 Read Discrete Inputs – Modbus Function Code 02 (0x02)
This function returns the state of the digital inputs.
Request
Start Address: 0x0000 (input1) to 0x00FF (Input 255)
Input Quantity: 0x0001 to 0x00FF
Response
The input states are indicated by bits one and two of the status byte. A 1 indicates that the input is
switched high ON. A 0 indicates that the input is switched low OFF. Bit zero of the return value will be
the state of the discrete input corresponding to the start address. For example, if a start address of
0x0001 is used, bit zero will be the status of input 2 assuming input 2 is found in the discrete input
address table.
Discrete Input State Byte
Bit 7 6 5 4 3 2 1 Bit 0
X X x x Input 4 Input 3 Input 2 Input 1
Errors
Input Read Error Function Code (1 Byte): 0x82
Exception codes (1 Byte): 0x01 – Function not supported.
0x02 – Incorrect combination of start address and input quantity.
5.3.3 Read Holding Register – Modbus Function Code 03 (0x03)
The Read Holding Registers function is used for counters, vin, temperature, humidity sensors, etc.
Request
32-bit sensor values are read from 16-bit register pairs. Consequently, sensors addresses and registers
must be even numbers.
Response
32-bit floating-point values are returned, either as little-endian or big-endian numbers, depending on the
configuration in the Modbus tab.
With little-endian ordering, a temperature reading of sensor 1 would return 0x800042A2. The least
significant word would be 8000 hex and the most significant word would be 42A2. This hexadecimal
value converts to a temperature reading of 81.25 degrees.
If a temperature or humidity sensor is not installed, a value of 0xFFFFFFFF (NaN) is returned. Other
inputs will show measured values of the open circuits.
Errors
Sensor Read Error Function Code (1 byte): 0x83
Exception Codes (1 byte): 0x01 – Function not supported.
0x02 – Incorrect combination of start address and input quantity
Xytronix Research & Design, Inc. Page 103