The Xentara Modbus Driver v1.2
User Manual
Channels
See also
Skill Data Points in the Xentara user manual

Modbus channels are a type of Xentara skill data point.

Modbus supports four types of channels:

  • Coils are single bits that can be written and read (digital outputs).
  • Discrete inputs are single bits that can only be read (digital inputs).
  • Holding Registers are 16-bit registers that can be written and read (analog outputs).
  • Input Registers are 16-bit registers that can only be read (analog inputs).

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.

Polling Channel Values

See also
Polls

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.

Writing Output Channels

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.

Accessing Modbus Channels

See also
Accessing Xentara Elements in the Xentara user manual

Modbus channels have the following members:

Attributes
keyThe channel’s primary key.
nameThe channel’s name. The name is the last component of the primary key.
UUIDThe unique UUID of the channel.
typeThe channel’s element type. For Modbus channels, this is always “Modbus coil”, “Modbus discrete input”, “Modbus holding register”, or “Modbus input register”.
categoryThe channel’s category. For Modbus channels, this is always “data point”.
channelTypeThe Modbus channel type. See Values for the channelType Attribute below.
addressThe 0-based Modbus address of the channel.
dataFormatThe data format used for analog values. See Values for the dataFormat Attribute below. Digital channels (Coils and Discrete Inputs) do not have this attribute.
valueThe current value of the channel. For output channels, this attribute can be written to write the output.
updateTimeThe last time the channel’s value was polled.
changeTimeThe last time the channel’s value changed.
writeTimeThe last time the output was written. Input channels do not have this attribute.
qualityThe quality of the channel’s value. See Data Quality in the Xentara user manual for an explanation of a data point’s quality.
errorThe error that occurred the last time the channel’s value was polled.
writeErrorThe error that occurred the last time an output channel’s value was written. Input channels do not have this attribute.
Events
changedThis event is raised when either the value, the quality, or the error changes.

Modbus TCP channels

Channels belonging to a Modbus TCP device have the following additional members:

Attributes
deviceAddressThe host name or IP address of the device.
devicePortThe TCP port number of the device.

Modbus RTU channels

Channels belonging to a Modbus RTU device have the following additional members:

Attributes
busThe serial port of the RTU bus.
serverIDThe server ID (formerly slave ID) of the device on the bus.

Values for the channelType Attribute

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)

Values for the dataFormat Attribute

See also
Analog Data Formats

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