Accessing Modbus Data
To access data using a Modbus datasource, it is necessary to create and configure a corresponding Modbus IO-Item object in the I/O Model.
-
To add a new IO-Item, select the Modbus datasource in the I/O Model, right click and in the context menu select
. -
In the Create Object wizard enter a name for the IO-Item which is unique in the branch of this datasource and, optionally, an Object Description.
-
Then enter the Item ID, following this schema:
MB.<Item Type code>:<Reference>
For Reference and Item Type refer to the vendor’s specification of the Modbus device. Then use the following table to find the Item Type Code corresponding to the Item Type.
The first reference number is 1, and it may be padded with zeros.Table 1. The Modbus Data Model Item Type Item Type Code Object Type Type of Access Comments Coils / Discrete Output
0
Single bit
Read-Write
This type of data can be altered by an application program.
Discrete Input
1
Single bit
Read-Only
This type of data can be provided by an I/O system.
Input Registers
3
16-bit word
Read-Only
This type of data can be provided by an I/O system
Holding Registers / Output Registers
4
16-bit word
Read-Write
This type of data can be altered by an application program.
-
In the Item Type section select 'Modbus'.
This value can only be changed during the creation of the object. Once the object is created, its Item Type is fixed and can no longer be changed.This Item Type property refers to the type of IO-Item object, not the type of the Modbus data item. -
Select the appropriate Data Type property for this IO-Item from the dropdown list.
-
In the Elements number property set the number of elements of the Data Type or the length of a string. For a value higher than 1 this will lead to an array output for any Data Type but 'String'.
-
Click Create to create the IO-Item in the I/O model.