MODBUS Functions

NET.MBLINK supports the following MODBUS function codes.

MODBUS FUNCTION

DESCRIPTION

01 - 0x01

Reads ON/OFF Status of discrete outputs (0X references, coils) in the slave device.  Broadcast is not supported

02 - 0x02

Reads ON/OFF Status of discrete intputs (1X references, coils) in the slave device.  Broadcast is not supported

03 - 0x03

Reads contents of status of holding registers (4X references, coils) in the slave device.  Broadcast is not supported.

04 - 0x04

Reads contents of status of input registers (1X references, coils) in the slave device.  Broadcast is not supported.

05 - 0x05

Writes ON/OFF state to (0X reference) in the slave device.   When broadcast, the function sets the same 0X reference in all attached slaves.

06 - 0x06

Write contents to (4X reference) in the slave device.  When broadcast, the function sets the same 4X reference in all attached slaves.

15 - 0x0F

Writes ON/OFF states to a consecutive sequence of (0X references). When broadcast, the function sets the same 0X reference in all attached slaves.

16 - 0x10

Writes 16-bit contents  to a consecutive sequence of (4X references). When broadcast, the function sets the same 4X reference in all attached slaves.

22 - 0x16

Writes ON/OFF state of an individual bit within a (4X reference). When broadcast, the function sets the same 4X reference in all attached slaves.

NET.MBLINK automatically executes the appropriate MODBUS function code based on:

NOTES:

  1. Data values are set and retrieved in the Tag.Value property

  2. MODBUS Exception Codes are reported in the Controller.ErrorCode | Controller.ErrorString properties

  3. By default MODBUS devices use Little Endian to store 32-bit values.  However, if the 32-bit value you are reading or writing does not seem to be correct, you can change the endianess to Big Endian by setting the Controller.SwapWords property.  

  4. NET.MBLINK will self-optimize communcations.

  5. Broadcasting to serial devices occurs by setting Controller.Path = "0"