|
Devices compatible with Modbus protocol.
Overview
Modbus driver implements communication with PLC and IO devices compatible with Modbus Open Standard protocol. It operates as a Client on TCP/IP or serial networks. The communication blocks are dynamically created according to the pooling cycle defined on the AccessType for each Device Point.
The following drivers are related with the Modbus Protocol:
The terminology Master and Slave refers to the original Modbus terms. The Modbus Organization announced the replacement of "master-slave" terminology with "client-server" in its communications protocol. The new nomenclature reflects the specific roles of the devices within the Modbus network. Here's the definitions:
Modbus Master (Client): In the context of the Modbus protocol, the "master" is the device that initiates communications. It’s called a Client because it requests data from other devices. The master actively controls when and how data is requested and collected in the network.
Modbus Slave (Server): Slave devices are referred to as Servers because they serve data to the master upon request. They passively wait for requests and respond by sending the requested data or performing actions based on the commands received. They do not initiate communication; they only respond to the master’s requests.
In the product User Interface, as will in the documentation URLs, we opted to keep the original historical nomenclature, in order to ensure compatibility, as well to avoid potential confusion with the terms Server and Client which already have other meanings in the context of the software platform.
At Designer, solution configuration tool, add the connector at:
The following options are also available to this connector:
This document has only information about the device connection settings and its address syntax.
For further Information on its configuration, see:
The configuration for this protocol can be created using The Tag Import CSV tools, or copy-paste directly to UNS Tags table.
Communication Driver Information | |
|---|---|
Driver name | Modbus |
Assembly Name | T.ProtocolDriver.Modbus |
Assembly Version | 1.11.0.12 |
Available for Linux | True |
Devices supported | Any PLC compatible with Modbus |
Manufacturer | N/A (Not Applicable) |
Protocol | MODBUS RTU, ASCII and TCP |
Interface | TCP/IP and Serial |
Protocol Options | Message Format (ASCII, RTU or RTU TCP), use block write command (0x0F or 0x10) or single write command (0x05 or 0x06) for single writings |
Multi-threading | User configurable. Default is 5 threads to each network node |
Max number of nodes | User defined |
PC Requirements | Ethernet port |
Operand | Read | Write | Data Type | Address size | Equivalent Operand |
0 – Coils | Yes | Yes | Bit | 1 bit | N/A |
1 – Input Status | Yes | - | Bit | 1 bit | N/A |
3 – Input Registers | Yes | - | Word | 2 bytes | N/A |
4 – Holding Registers | Yes | Yes | Word | 2 bytes | N/A |
%Q – Coils | Yes | Yes | Bit | 1 bit | 0 |
%M – Coils | Yes | Yes | Bit | 1 bit | 0 |
%I – Input Status | Yes | - | Bit | 1 bit | 1 |
%IW– Input Registers | Yes | - | Word | 2 bytes | 3 |
%MW – Holding Registers | Yes | Yes | Word | 2 bytes | 4 |
%QW – Holding Registers | Yes | Yes | Word | 2 bytes | 4 |
ID – Device Identification | Yes | - | Text | 1 byte (Object Id) | N/A |
All operands with a percentage symbol (%) mentioned above are used for specific cases. In general, Modbus only uses operands from 0 to 4. |
If the communication points are configured in sequence and the BlockSize equals to 250, the driver can create the internal groups with 125 Registers or 2000 Coils.
Serial and MultiSerial channels:
Set the other fields according to your Serial or MultiSerial port configuration.
TCP/IP channels:
Serial channels:
E.g.: 1
MultiSerial channels:
Where:
<Com Port>: the serial port number
TCP/IP channels:
Where :
E.g.: 192.168.1.101 ; 502 ; 1
From FrameworX 10.1.6, an online configuration change to a Modbus Master node or its points rebuilds only the affected node. The other nodes on the channel keep communicating without missing a poll.
These changes still restart the whole channel: any change to the channel or to the AccessType table, renaming a node or moving it to another channel, and server-mode, unsolicited or shared-connection channels. The restart runs on its own when you save the change with online configuration on. In 10.1.5, every online change to a node or point restarted the whole channel. See Runtime How-to.
The syntax for the Modbus communication points is: <Operand><Address>
Where:
Valid values for <Operand> |
|---|
0 – Coils |
1 – Input Status |
3 – Input Registers |
4 – Holding Registers |
%Q – Coils |
%M– Coils |
%I – Input Status |
%IW– Input Registers |
%MW – Holding Registers |
%QW – Holding Registers |
ID – Device Identification (see below) |
E.g.: 400001 (Operand = Holding Register, Address = 1)
Configure ASCII Communication:
To read or write one bit of a holding register, set the Bit modifier on the Point and use DataType Word. The driver addresses the bit correctly only with DataType Word.
From FrameworX 10.1.6, the driver refuses these Points when it prepares the connection:
A refused Point is not added to the connection, and the Trace Window reports it by address. The other Points on the channel keep communicating. In 10.1.5, the driver accepted these Points and returned wrong data. With DataType Byte, a bit index above 7 was ignored on read, and a write replaced the whole register with the single bit. With DataType Bit, the values did not follow the register. After the upgrade, check the Trace Window for refused Points and set bit Points to DataType Word. |
Devices that implement MODBUS function 43 with MEI type 14 (Read Device Identification) publish a set of standard text objects describing themselves: vendor name, product code, revision and, optionally, model and application names. The connector reads these objects as read-only text Points, so a solution can identify equipment automatically instead of depending on vendor specific holding registers mapped by hand for each device model.
Use the ID operand. The address is the MODBUS Object Id itself, 0-based, written with the same 5-digit padding as any other Modbus address. The object ids below are defined by the MODBUS specification and are the same on every device that implements the function.
Address | Object Id | Object | Support |
|---|---|---|---|
ID00000 | 0x00 | VendorName | Mandatory |
ID00001 | 0x01 | ProductCode | Mandatory |
ID00002 | 0x02 | MajorMinorRevision | Mandatory |
ID00003 | 0x03 | VendorUrl | Optional |
ID00004 | 0x04 | ProductName | Optional |
ID00005 | 0x05 | ModelName | Optional |
ID00006 | 0x06 | UserApplicationName | Optional |
ID00007 to ID00127 | 0x07 to 0x7F | Reserved by the MODBUS specification | - |
ID00128 to ID00255 | 0x80 to 0xFF | Vendor private objects, meaning defined by the manufacturer | Optional |
E.g.: ID00001 reads the device product code.
Condition | Result |
|---|---|
The device does not implement function 43 | All identification Points read empty with Bad quality. A warning is written to the Trace naming the exception returned by the device. Communication is not affected: the exchange completes normally and the channel stays connected. |
The device implements function 43 but does not publish one of the objects | That Point reads empty with Bad quality. Every other identification Point keeps its value and Good quality. |
The device is unreachable | Normal communication failure handling applies, the same as for any register Point. |
Function 43 is optional in the MODBUS specification. A device that does not implement it answers with an exception, which the connector reports without disturbing the rest of the channel: register Points on the same node keep reading normally. |
If a device splits its identification data across several responses, this version reads the first response only. Objects that the device would return in a following response read empty with Bad quality. The three mandatory objects (VendorName, ProductCode, MajorMinorRevision) are always in the first response. |
To perform block writes (as done with function 16), you should use WriteTrigger-based writing so that all addresses are sent in the same block (i.e., within the same network packet). To do this, create a separate Devices / AccessType with the “WriteEvent” column disabled, and add a tag in the WriteTrigger column to trigger the message.
These codes come from the slave device in a Modbus exception response. Connection, transport and driver level errors are reported separately as negative codes: see Devices Monitor Reference for the full negative code table.
Modbus protocol exception codes returned by the slave device | ||
|---|---|---|
Error | Name | Description |
1 | ILLEGAL FUNCTION | The function code received in the query is not allowable. |
2 | ILLEGAL DATA ADDRESS | The data address received in the query is not allowable. |
3 | ILLEGAL DATA VALUE | A value contained in the query data field is not allowable. |
4 | SLAVE DEVICE FAILURE | Error while attempting to perform the requested action. |
5 | ACKNOWLEDGE | Request accepted, but a long duration of time will be required. |
6 | SLAVE DEVICE BUSY | The slave is engaged in a long–duration program command. |
7 | NEGATIVE ACKNOWLEDGE | Cannot perform the program function received in the query. |
8 | MEMORY PARITY ERROR | Parity error in the extended memory. |
Modbus Revision History | |
|---|---|
Version | Notes |
1.11.0.12 | Writing a text (ASCII) point now sends exactly two data bytes per register, and the byte count matches the number of registers written. Before, the request carried extra zero bytes, and devices that check the request rejected the write with exception 03 (Illegal Data Value). |
1.11.0.11 | A write to a point with a bit selection first reads the register. When the device refuses that read, the write now reports the device's exception code instead of an error with code 0. |
1.11.0.10 | The node Test in Designer now tells a device that answered with an exception apart from a failed connection, and names the answer. In RTU mode, an exception reply from the device is no longer read as a byte count. |
1.11.0.9 | Points whose bit selection does not fit the point's data type, or whose register address is out of range, are now rejected at start with Bad quality and a Trace message; before, such a point read 0 silently and a write could erase the whole register; online changes to a node or its points now restart only that node instead of the whole channel. |
1.11.0.1 | Initial release on new documentation standards. |