Last updated: September 3, 2003
Introduction
This document is
one of five that describes the basic ICON program (skeleton.icn)
which normally provides the framework for all ICON programs. This document
describes the module named "Modbus Inputs" which reads external sensor
data into your ICON program. Each block contains the following functions:
Module Modbus Inputs
Constant Override
enable
General Parameters
Variable: | override_enable1 | Set to override_enable2 for the second block, etc. Value of 0 is no override, 1 enables override |
Data type: | Float | |
Mode: | Capture |
If
Override values
Table Parameters
Variable | Status | Expression | Description |
Module | 0 | override_enable1 | If override_enable1 is set to 1 then this If block is executed. This block loads override data. |
Constant Override
values
General Parameters
Variable: | data1 | Set to override_values2 for the second block, etc.) (Values set override values of Modbus registers for testing.) |
Data type: | Float | |
Mode: | Normal |
Elseif
Otherwise
get actual Modbus data
Table Parameters
Variable | Status | Expression | |
Module | 0 | 1 | This block will be executed if the If block is not. This block gets Modbus data. |
OWconfig Configure
1-wire ICON
General Parameters
Config: | OW_config1 | Use OW_config2 for the second block, etc. |
Modbus
Send
config to ICON
General Parameters
Parameter | Example | Description |
Enable: | Null | |
Status: | Null | |
I/O transfer: | OW_config1 | Use OW_config2 for the second block, etc. |
Com type: | 2 | You may select serial port 1 or 2 depending on which serial port your Modbus device is connected (usually 2). |
IP address: | 0.0.0.0 | |
Port: | 502 | |
Unit Address: | 255 | The address of the Modbus device. |
Register address: | 4097 | |
Command: | Set multiple registers(16) | |
Register type: | Unsigned integer | |
Timeout: | 50 | 50 would cause the Modbus instruction to fail if a response from the remote Modbus device was not received within 500 mS. |
Retries: | 3 | Allow command to be attempted 3 times before setting failure status. |
Modbus
Read
data
General Parameters
Parameter | Example | Description |
Enable: | Null | |
Status: | status1 | Use status2 for the second block, etc. |
I/O transfer: | data1[1] | Use data2[1] for the second block, etc. |
Com type: | 2 | You may select serial port 1 or 2 depending on which serial port your Modbus device is connected (usually 2). |
IP address: | 0.0.0.0 | |
Port: | 502 | |
Unit Address: | 255 | The address of the Modbus device. |
Register address: | 1 | Select the Modbus starting register address. For reading 1-wire devices and for most other Modbus devices you will use 1. This can only be found in your Modbus device documentation. |
Command: | 4 | Select Read Coils(1), Read input discretes(2), Read registers(3) or Read input registers(4) as appropriate for your Modbus device. |
Register type: | Unsigned integer | You may pick as appropriate. It does not matter for Commands 1 and 2. |
Timeout: | 50 | |
Retries: | 3 |
ExpressionSet
Modbus Status
Table Parameters
Result: | Expression: | Description |
data1 (Use data2 for the second block, etc.) | status1>1 | Since we are using "real" Modbus data the program exports the "real" modbus status. Notice the status is in the first element of the data array. Its value is 0 if the Modbus operation was successful and 1 if the Modbus read failed. |
Endif
Fan Export
data for 1st Modbus read
General Parameters
Source: | data1 | Use data_selected2 for the second block, etc. |
Destination: | #raw1 | Use #data2 for the second block, etc. This is the exported data that will be used by other modules. |
Count index: | Null | |
Time index: | Null | |
Time def: | Null | |
Last period: | Null. | |
Block size: | 17 | Set to length of Modbus read plus 1 for status. |
Number of indexes: | 1 | |
Direction: | Multiple sources to one destination |
The following instruction is entered only one time at the end of the module to export the master Modbus alarm !alarm which is set if any individual Modus fail alarm sets.