Modbus Write Function Block

Figure 1: Modbus Write Point Function Block

Figure 2: Modbus Write Point Property Sheet

Input

Input Name

Description

In

Writes to the Modbus holding register

Numeric: 32-Bit floating point value (float), "null" = Ignore

n:child

Shows the relation to the corresponding Modbus device in the wiresheet.

Table 1: Inputs of Modbus Write Function

Output

Output Name

Description

Out

Modbus Output

32-Bit value, Null

(This value type can be Boolean, Integer, Unsigned Integer or float)

Boolean- This value type represents the data in two states viz. true or false, on or off etc. This data is stored in a 32-Bit (4 byte) register ranging from 0-1.

Signed Integer or Integer- A signed 32-bit integer, is a variable type taking up 4 bytes in memory, with the ability to hold a value ranging from -2147483648 to 2147483647.

The signed part of the integer refers to its ability to represent both positive and negative values.

Unsigned Integer- A 32-bit unsigned integer can hold a value from 0 to 4294967295.

Float- A float is a 32-bit single precision value, sometimes called real. With a floating type value, very small and large numbers are possible.

When the system is not able to read from the register it will display output as null.

Outcause

Exception Code/ Cause

Numeric: 32-bit value

Outcause Enums:

0: No error

1: Illegal register address

2: Illegal argument

3: Porting layer error

4: Insufficient resources

5: I/O Error

6: Protocol stack In Illegal state

7: Retry I/O operation

8: Timeout error occurred

10: Illegal function exception

11: Illegal data address

12: Illegal data value

13: Slave device failure

14: Slave acknowledge

15: Slave device busy

16: Memory parity error

17: Gateway path unavailable

18: Gateway target device failed to respond

100: Others

255: Data Not Ready (When the register is in initial configuration).

Table 2: Outputs of Modbus Write Function

Parameter

Parameter Name

Description

Write Point Type

Modbus Slave Register Type

Enumerated: 1-4 Default: 1

5: Write Single Coil (FC-5)

6: Write Single Register (FC-6)

15: Write Coils (FC-15)

16: Write Multiple Registers (FC-16)

Device Address

ModBus device address (to which this coil belongs to)

Device Address is unique across modbus network.

Byte Order

It determines the byte order to be considered when communicating with the modbus registers.

0: Big Endian (e.g Byte1, Byte 2, Byte 3, Byte 4 for a 32-bit integer value) - For Register and for Word (2 register read), you get MSB first from Modbus device.

1: Little Endian (e.g Byte 2, Byte 1 or Byte 4, Byte 3, Byte 2, Byte 1) - For Register and for Word, you get LSB (2 register read) first from Modbus device.

2: Little Endian with word swap (e.g. Byte 2, Byte 1, Byte 4, Byte 3) - For Register, you get LSB first and for Word (2 register read), you get MSB first from Modbus device.

3: Big Endian with word swap (e.g. Byte 3, Byte 4, Byte 1, Byte 2) - For Register, you get MSB first and for Word (2 register read), you get LSB first from Modbus device.

Significant Change

Difference between the current value of In and last transmitted value, that will cause the new value to be sent to the Modbus device.

Numeric: 32-Bit floating point value (float) Default: 0.

Data Format

Enumerated; Range: 0-7; Default:0

0: Single Bit

1: Int16

2: uint16

3: int32

4: uint32

5: float (4-byte, single precision)

Operation Mode

Enumerated; Range: 1-2; Default: 2-PeriodicSending

1: Do Not Send

2: Periodic Sending

Out Save

Master Sync Enabled : If you set it to "true" the last output will be set as output for one cycle after the controller restarts. The application can use it to return to the same state before the controller restart.

Out: To enable or disable the Out feature.

Out Cause:To enable or disable the Out Cause feature.

Table 3: Parameters of Modbus Write Function

Follow the below steps to add Modbus Write Point:

  1. Double-click on the Modbus device to view below Modbus Device Configuration View screen

  2. Select Write Points tab and click Add

  3. Figure 3: Modbus Device Configuration Screen

  4. Enter the following detail like the Point name, Write Point address, Write Point Type, and Data Format in the Modbus Write Point window. In the below example, for Loytec Thermostat and its Modbus details.

  5. Click OK.

Figure 5: Example- Modbus Write Device

Refer to General Description for general information about IRMN4 Function Blocks.