Figure 1: Modbus Read Point Function Block |
Figure 2: Modbus Read Point Property Sheet |
Input
Input Name |
Description |
n:child |
Shows the relation to the corresponding Modbus device in the wiresheet. |
Table 1: Inputs of Modbus Read 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 Read Function
Note: Only Out and OutCause are exposed to the user on Wiresheet. All other parameters are hidden.
Parameter
Parameter Name |
Description |
Read Point Type |
Modbus Slave Register Type Enumerated: 1-4 Default:1 1: Read Coil (FC - 1) 2: Read Discrete Inputs (FC - 2) 3: Read Holding Registers (FC - 3) 4: Read Input Registers (FC - 4) |
Device Address |
It is the slave device address (Modbus Slave devices connected to the serial network) 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, Byte2, Byte3, Byte4 for a 32-bit integer value) - For Register and for Word (2 register read), you get MSB first from slave device.
1: Little Endian (e.g. Byte2, Byte1 or Byte4, Byte3, Byte2, Byte1) - For Register and for Word, you get LSB (2 register read) first from slave device.
2: Little Endian with word swap (e.g. Byte2, Byte1, Byte4, Byte3) - For Register, you get LSB first and for Word (2 register read), you get MSB first from slave device.
3: Big Endian with word swap (e.g. Byte3, Byte4, Byte1, Byte2) -For Register, you get MSB first and for Word (2 register read), you get LSB first from slave device. |
Read Point Address |
Numeric: 32-Bit (integer); Default: 0 A 32-bit integer, is a variable type taking up 4 bytes in memory, with the ability to hold a value ranging from -0 to 65535. |
Operation Mode |
Enumerated; Range: 0-2; Default: 0 1: Do not read (Output is NULL) 2: Low Polling rate (Register is read after multiple of 5seconds) one register at a time. 3: Medium Polling rate (Register is read after all high priority registers are read) one register at a time. 4: High Polling rate (Register is read every 50miliseconds). Note: If no high priority polling rate is assigned to any register, medium priority register will be read every 50 milliseconds one register at a time if present. |
Scaling Factor |
Power of 10 Scaling Factor to apply to the register value to convert it to the required units. e.g. a scale factor of +2 would multiply the value by 100, a scale factor of -2 would multiply the value by 0.01 Note: This parameter is not valid for Register Type 1 (Read Coil FC-1) and 2 (Read Discrete Inputs FC-2) |
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) |
EventBit Masking |
EventBit Masking decides which bits in the data is received from the Modbus device need to be retained for processing the Read Data Register. The other bits are ignored.The Event program folder will be invoked upon successful change of value in the masked bit area. Numeric: 32Bit (integer) Range:0x00000000 to 0xFFFFFFFF (HEX) Default Value: 0xFFFFFFFF (HEX). Periodic Folder- If the FB is in the periodic program wiresheet it will take a delay of max 500ms until the value is used for the logic. Event Folder- If we put the FB in the event program wiresheet it will immediately execute the logic, whenever the value changes to > 0. |
Out Save |
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 Read Function
Note: The parameters "Device Address", "Byte order"and "Max Read Registers Count" are copied from Modbus Device Function Block and are non-editable in the Modbus Read function block. This can be done in the parent Modbus Device function block. .
Follow the below steps to add Modbus Read Point:
In the Nav tree, expand the IRM Program folder of the controller and double- click on the Periodic program.
Drag and drop ModbusDevice from palette to periodic program wiresheet.
Figure 3: Adding Modbus Device
If desired, you can change the Modbus device name.
Double-click on the Modbus device to view below Modbus Device Configuration View screen.
Select Read Points tab and click Add.
Figure 4: Modbus Device Configuration Screen
Enter the following detail like the Point name, Read Point address, Read Point Type, and Data Format in the Modbus Read Point window. In the below example, for Loytec Thermostat and its Modbus details
Click OK.
Figure 5: Example- Modbus Read Device
The Point type to read is "Read Holding Registers" with register as "48". Operation mode shall be set to Low (as temperaute is analog input. Set Operation mode to Medium or High depending on their impact to the control), scaling factor depending on the output value and data format as Int16, Event Bit Masking as 0xFFFFFFFF, as there is no need to block the bits.
Figure 6: Example- Modbus Read Device
Refer to General Description for general information about IRMN4 Function Blocks.