The Xentara Modbus Driver v1.1
User Manual
|
Modbus channels are a type of Xentara I/O point.
Modbus supports four types of channels:
Each of the four types of channels has their own address space. The addresses in each address space range from 0 to 65535, inclusively. So, a modbus device may have a coil with address 0, a discrete input with address 0, a holding register with address 0, and an input register with address 0, all at the same time.
The values of modbus channels must be polled. This means that Xentara must send one or more commands to the device to query the values. This is accomplished by attaching the channel to one a poll object. The value of a channel that is not attached to a poll will not be available.
It is not necessary for all channels to be associated with a poll. In particular, output channels need only be associated with a poll, if you want to read back the output’s value from the device. Some devices may even have write-only channels, whose value cannot be read. Such channels should not be associated with a poll, or that poll will then likely fail with an error when it is executed.
When the value of a channel is written, it must be sent to the device. This must be cooredinated with poll commands sent to the same Modbus TCP device or over the same RTU bus, to ensure that the commands do not step on each other. To allow you to accomplish this, each device has a task named writeOutputs that must be inserted into a Xentara execution pipeline. If you do not schedule this task, the written values will never be sent to the device.
In addition to the standard members of Xentara I/O points, Modbus channels have the following attributes:
channelType | The Modbus channel type. See Values for the channelType Attribute below. |
address | The 0-based Modbus address of the channel. |
dataFormat | The data format used for analog values. See Values for the dataFormat Attribute below. Digital channels (Coils and Discrete Inputs) do not have this attribute. |
value | The current value of the channel. For output channels, this attribute can be written to write the output. |
updateTime | The last time the channel’s value was polled. |
changeTime | The last time the channel’s value changed. |
writeTime | The last time the output was written. Input channels do not have this attribute. |
quality | The quality of the channel’s value. See The Quality Attribute in the Xentara user manual for an explanation of an I/O point’s quality. |
error | The error that occurred the last time the channel’s value was polled. |
writeError | The error that occurred the last time an output channel’s value was written. Input channels do not have this attribute. |
Channels belonging to a Modbus TCP device have the following additional attributes:
deviceAddress | The host name or IP address of the device. |
devicePort | The TCP port number of the device. |
Channels belonging to a Modbus RTU device have the following additional attributes:
bus | The serial port of the RTU bus. |
serverID | The server ID (formerly slave ID) of the device on the bus. |
Modbus channels have the following events:
value | The value attribute changed. |
quality | The quality attribute changed. |
error | The error attribute changed. |
changed | Any of the above attributes changed. |
The channelType attribute can have the following values:
Value | Type |
---|---|
1 | coil (digital output) |
2 | discrete input (digital input) |
3 | holding register (analog output) |
4 | input register (analog input) |
The dataFormat attribute can have the following values:
Value | Format |
---|---|
1 | uint16 |
2 | int16 |
3 | uint32 |
4 | int32 |
5 | uint64 |
6 | int64 |
7 | uint32LE |
8 | int32LE |
9 | uint64LE |
10 | int64LE |
11 | floatABCD |
12 | floatBADC |
13 | floatCDAB |
14 | floatDCBA |