Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Modbus registers of a device are organized around the four basic data reference types noted above and this data type is further identified by the leading number of the reference address as follows: 


Modbus Addresses

Modbus devices have 4 types of addresses:

  • Coil
  • Discrete Input
  • Input Register
  • Holding Register

Coils are 1-bit (boolean) read/write devices. Each coil can be in either on or off state. Discrete inputs are similar to coils, but they are read-only - it’s impossible to set the value of a discrete input. You can think of Coils as outputs of a PLC and Discrete Inputs as input of a PLC.

Holding registers are like PLC memory. They are 16-bit words which you can both read and write via Modbus protocol. Input Registers are also 16-bit words, but they are read-only, like readings of a sensor.

A Modbus address is a 16-bit unsigned integer that is transmitted with every request to indicate which data should be read or written. Address occupies two characters in the Modbus message and the most significant byte is sent first (big-endian).


Image Added

Supported function codes

Functions codeFunctionsSpesifics
FC01Read CoilsThis function code allows the master to query the state of slave’s coils.read coils request is always 8 bytes long. 
read coils response is at least 6 bytes long.
FC02Read Discrete InputsThis function code allows the master to query the state of slave’s discrete inputs.read discrete inputs request is always 8 bytes long.
read discrete inputs response is at least 6 bytes long.
FC03Read Holding RegistersThis function code allows the master to query the state of slave’s holding registers.read holding registers request is always 8 bytes long. 
read holding registers response is at least 7 bytes long.
FC04Read Input RegistersWith this function code, master queries the state of slave’s input registers.read input registers request is always 8 bytes long. 
read holding registers response is at least 7 bytes long.
FC05Write Single CoilSets the value of a single slave’s coil.write single coil request is always 8 bytes long.
response?
FC15Write Multiple CoilsSets the value of a single slave’s holding register.
FC06Write Single RegisterSets the value of a consecutive range of slave’s coils.
FC16Write Multiple RegistersSets the value of a consecutive range of slave’s holding registers.
FC23Read/Write Multiple RegistersIt combines reading and writing functions, allowing the master to read and write values of multiple holding registers in a single request





Start configuration with a client/master Modbus TCP Client/Master

...