Appendix E - Supported Modbus Functions

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Appendix E - Supported Modbus Functions

Congrego® supports a number of Modbus function codes.

The following table summarises the available Modbus commands, some of these are available as a Master device, a Slave device or both.

 

Data Addresses

Read

Write Single

Write Multiple

Output Coils 0xxxx

FC01

FC05

FC15

Input Contacts 1xxxx

FC02

n/a

n/a

Analog Input Registers 3xxxx

FC04

n/a

n/a

Analog Output Holding Registers 4xxxx

FC03

FC06

FC16

 

Function Codes

FC01 – Read Coil

This function returns each channel’s value as a single bit. A zero value is ‘0’, all non-zero values are ‘1’.

This function is intended for use with digital channels, but will work for scalar channels as well.

Two coils are assigned to each channel so they align with registers in other functions. Querying either coil will return the same value.

 

FC02 – Read Input Status

Each channel is assigned two 1-bit registers. The first register will return ‘1’ if the channel has a bad status. This can be used for filtering out nulls, faults and calibration data.

The second register will return ‘1’ if the channel is in calibration and not registering a fault.

 

FC03 – Read Holding Registers

Each channel is assigned two 16-bit registers. This will contain the channel’s current value as a 32-bit IEEE754 floating point number.

Null values are substituted with ‘NaN’. The endianness can be configured in the modbus slave configuration.

 

FC04 – Read Input Registers

Each channel is assigned two 16-bit registers. Each register contains the 8-bit status code for the channel. Querying either register will return the same result.

 

FC05 – Force Single Coil

This function allows setting the coils, and can set the value of a channel.

For a digital instrument channel, this will set the instrument’s channel value to on or off. For a scalar channel, this will set the instrument’s channel value to 0.0 or 1.0.

Setting either coil allocated to a channel will set the channel value on the instrument.

This functionality requires the channel’s direction to be set to ‘output’ or ‘bi-directional’.

 

FC06 – Preset Single Register

This function is not supported because each channel’s value is stored across multiple registers. Please use FC16 to preset registers.

This function will always return an ‘Illegal Function’ error code.

 

FC15 – Force Multiple Coils

This function allows for the setting of multiple coils in a single message.

It will attempt to set all coils, even in the event of an error. If both coils for a single channel are assigned different values, ‘ON’ will be assumed.

This functionality requires the channel’s direction to be set to ‘output’ or ‘bi-directional’.

 

FC16 – Preset Multiple Registers

This function allows multiple holding registers to be written to. Data is to be encoded as 32-bit IEEE754 floating point values in the configured endianness.

It will attempt to set all channel values, even in the event of an error.

This functionality requires the channel’s direction to be set to ‘output’ or ‘bi-directional’.

 

FC17 – Report Slave ID

This function will return the ID of the requested slave, followed by a run indicator flag.

It will return ‘0x00’ if the Congrego® back-end is stopped or reloading, and ‘0xFF’ if the back-end is running.