Tag Config
Tags configured for retrieval from Modbus registers to cloud signals, using a general structure that is common for all modules. The relevant parts of the tag configuration that are relevant to the Modbus retrieval are:
ModuleId: Name of the module, which is ModbusModule Input.Source: String that defines the address, datatype and unit to retrieve data from. Input.Endpoint: Slave Id that defines the slave the data must be retrieved from. Input.SamplingRate: Configuration that defines how often the signal is sampled from the Modbus slave Input.MeasurementType: Desired data type.
The Input.Source property, is the one that defines precisely where each value should be retrieved within the Modbus slave:
For example (fields are separated by ; just as OPC UA node configurations):
Source = "adr=40003;unit=1;datatype=uint32;reg=0;blockid=1;"reg is the register that should be accessed, where:
0
Holding Register
Read/write
16 bits
1
Coils
Read only
1 bit
2
Discrete Inputs
Read only
1 bit
3
Input Registers
Read/write
16 bits
adr is the start address that you want to read from. Do not use 5- or 6- digit address space notation, but in stead without register offset (for example reg=0;adr=3; for address 3 in the Holding Register). unit is the unit identifier, to identify the units attached to the slave datatype is the type of data that should be read from register. It supports the following types:
bit
1
0/1
uint16
16
0 -> 65535
int16
16
-32768 -> 32767
uint32
32
0 -> 4294967295
int32
32
2147483648 -> 2147483647
float32
32
1.2E-38 to 3.4E+38
blockid The client also supports block reads. This means that all tags configured with the same block id will be read in a single operation (from lowest to highest address). If no block id is specified, the value is read in a separate operation.
For example:
Tag1: Source = "adr=3;unit=1;datatype=uint32;blockid=1"
Tag2: Source = "adr=7;unit=1;datatype=int16;blockid=1"
Tag3: Source = "adr=11;unit=1;datatype=uint32;blockid=1"This will execute a block read between the smallest (3) and the highest (11 + 2 words) address, and assign the values to the desired signals (safeguards are present to make sure the block read is reasonable sized). Block reads must be within same unit, but data types can be different.
Multiple block reads are possible.
Read of single bit from an analog register If you want to read a single bit from a word in a register (holding register or input register), it can be done by specifying the desired bit using a '.' after the address. Bits are numbered 1 to 8.
As an example, this reads bit number 4 from a word at address 3 in the holding register:
Source = "adr=3.4;unit=1;datatype=bit"Last updated
Was this helpful?