The Xentara Modbus Driver v1.2
User Manual
|
Modbus channels are a type of Xentara skill data 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.
Modbus channels have the following members:
key | The channel’s primary key. |
name | The channel’s name. The name is the last component of the primary key. |
UUID | The unique UUID of the channel. |
type | The channel’s element type. For Modbus channels, this is always “Modbus coil”, “Modbus discrete input”, “Modbus holding register”, or “Modbus input register”. |
category | The channel’s category. For Modbus channels, this is always “data point”. |
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 Data Quality in the Xentara user manual for an explanation of a data 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. |
changed | This event is raised when either the value, the quality, or the error changes. |
Channels belonging to a Modbus TCP device have the following additional members:
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 members:
bus | The serial port of the RTU bus. |
serverID | The server ID (formerly slave ID) of the device on the bus. |
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 |