User manual

Modbus Communication and Connectivity
16
5.4.5 Read Input Status (0x02)
The input status block contains read-only status accessible to the
users. It can be read by using function code 0x02 in the same as read-
ing coil status.
5.4.6 Error Handling
According to the Modbus specification, the OpenComms NIC-485 com-
poses the following exception responses to the client if an exception or
error occurs.
Exception code is one of the following:
01: Unsupported Function code
02: Out-of-range data addresses
03: Out-of-range data value (write to holding registers)
04: There is currently no LMD device connected to the server
05: Server is composing response but cannot response to the client
within the time limit required by Modbus specification.
Modbus Packet Formats
Each Modbus packet consists of the following fields:
Device Address
Function Code
Data Field(s)
Error Check Field
Device Address
The address field immediately follows the beginning of the frame and
consists of eight bits. These bits indicate the user assigned address of
the slave device that is to receive the message sent by the attached
master device.
Each slave OpenComms NIC-485 must be assigned a unique address
and only the addressed slave will respond to a query that contains its
address.
Function Code
The function code field tells the addressed slaves what function to per-
form. Function codes are specifically designed invoke a specific action
by the slave device. The function code range is from 1 to 127. However,
the OpenComms NIC-485 module primarily uses Function Code 3
(Read Holding Registers) and Function Code 6 (Preset Single Register).
Table 5 Exception response
Server
Address
Function Code
(0x80)
Exception
Code
16 Bit
CRC
1 byte 1 byte 1 byte 2 bytes