Overview
The Modbus Tutorial This tutorial explains how to configure platform-to-device communication by using the Modbus protocol. In the software platform, the Devices module manages communication with field devices through the Channels, Nodes, and Points by , allowing stable and secure data exchange between multiple devices across different networks.
The concepts presented concepts apply to all communication drivers. You can define multiple protocol interfaces using the abstraction layers such as like Channels and Nodes. The only big difference in using one or another protocol main difference between protocols is the syntax on the STATION and ADDRESS fields. All in some fields, but the configuration and testing procedures are similar for all communication protocol drivers.
Note that not all available protocols may be installed on your computer. Check the Communication Drivers page for more detailed information about on what you must to do if you require a device protocol not listed on your system.
On this page:
Table of Contents maxLevel 3 style none
Modbus Protocols
The Modbus communication protocols allow data exchange between Master and Slave devices. Each uses a specific protocol; therefore, there is one protocol for Masters and another for Slaves. Both protocols are available on the software platform. You can check and manage which protocols are available by clicking on the Product Series in Solution Manager. You can also check this in Solution Designer. To do so, go to Devices → Protocols or Devices → Channels. Both interfaces allow you to start device configuration by creating a channel using a target protocol.
The terminology Master and Slaves refers to outdated 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 a clearer explanation:
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.
Modbus Master
The Modbus Master protocol dynamically creates blocks based on the AccessType configurations set for each data point. It allows for selecting message encoding types such as ASCII, RTU, or RTU TCP - a combination of RTU and TCP/IP. It is worth noting that TCP/IP and UDP/IP are transport layer protocols in the OSI model.
The Modbus Master Protocol supports serial, multi-serial, and TCP/IP interfaces. This results in slight differences in some attributes for each supported interface. For example, considering the Modbus Master Protocol, the Settings column presents different parameters according to the selected communication interface. It happens on the Nodes, where the PrimaryStation settings differ according to each protocol. However, generally, the procedure is very similar, and most settings are the same.
Configuration Outline
Technical Overview
All initial configurations for devices in the solutions on the software platform encompass the following workflow:
- Defining a Channel using a target communication Protocol. It will create the base instance for linking a Node;
- Defining the Node linked to the created Channel;
- Defining the Point that you would like to monitor.
Protocols define communication rules between the platform and devices. Channels define global parameters for the usage use of a communication protocol. Nodes represent the physical field devices (like a PLC) with a unique field address (PrimaryStation). Points represent tags within a device. Additionally, AccessType defines how the device interacts with the platform (Read and/or Write).
Solution creation
Solutions refer to the applications developed on the software platform. Their purpose is to store all configuration information for applications. The solution saves its configuration in a file with the ".dbsln" extension. It is a database file that stores all configuration items of an application, such as Tags, Alarms, Devices configurations, graphical displays, scripts, etc.
You open the solution file on Solution Manager and edit the solution through the Solution Designer. These interfaces allow you to manage and design your solutions on the software platform. The Solution Designer organizes engineering configurations by modules. They are on the left, in the Solution Explorer menu.
Installing the software platform is the only requirement to create a solution. Once installed, go to Solution Manager and create a new Solution to configure the device.
To create a new Solution, on the Solution Manager at the top of the solution list, click the New... button to start the New Solution Wizard:
- Define the Product Series for your solution by selecting the product family and the product model.
- Define the target platform for your solution by selecting Windows or Multi-platform.
- Define the name and location for saving your solution file. Then, you can select a solution template and press the Create New Solution button. Or only press the button to create. When you do this, it will create a new Solution using a blank template.
All initial configurations for devices in the solutions on the software platform follow this workflow:
Define a Channel using a target communication Protocol. It will create the base instance for linking a Node;
Define the Node linked to the created Channel;
Define the Point that you want to monitor
Expand | ||
---|---|---|
| ||
Once created, go to Solution Manager and double-click to open it in Solution Designer.
After that, you can start the device configuration by creating a Channel.
Channels configuration
Channels refer to implemented communication protocol within a solution. Their purpose is to define global parameters for the protocol usage. They group the devices that use the same protocol logically.
Creating a Solution within the software platform is the only requirement for configuring a Channel in the Devices module using a standard protocol.
To create a new Channel, follow the steps:
On the Solution Designer, find the left menu, go to Devices, and expand it. There are two following ways to create a Device's Channel:
Go to Devices → Protocols, select the desired protocol on the main grid, then click the New Channel button to open the Create New Channel dialog.
Go to Devices → Channels, click the Add button on the grid's top-left to open the Create New Channel dialog.
In the Create New Channel dialog:
Select the Modbus Master Protocol.
Choose a name for the Channel.
Select the interface. For this tutorial, select TCPIP.
Press the OK button to create a Channel using the selected protocol.
Expand | ||
---|---|---|
| ||
It will insert a new line in the Channels data grid. Some configurations are accessible through the Channels data grid, such as ProtocolOptions, Channel Settings, Timeout, and InitialState options, but they which are optional and detailed in the Additional Configurations section.detailed in the following sections:
Expand | ||
---|---|---|
| ||
Click the "ProtocolOptions" column to define specific parameters for the protocol information that will be used.
Encoding options ASCII: The message is encoded in ASCII mode, where each 8-bit byte corresponds to a message sent as two ASCII characters. RTU: Remote Terminal Unit mode, where each 8-bit byte in a message contains two sets of 4-bit hexadecimal characters. RTU TCP: Transmission mode by default when the message is held in Modbus TCP/IP protocol. Contains information to enable the person concerned to receive the full messages, even if these are divided into several packages. Attention: for most devices using TCP/IP networks you need to select RTU TCP as the protocol encoding.
|
Expand | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||
Click the "Settings" column to fine-tune the channel options used in the configuration. If you use Serial (RS232/485) or TCP/IP, the contents of that column will differ. Typically, you can keep the default values, and it is unnecessary to edit this column. Here are examples of the contents for different selected interfaces.
|
Expand | ||
---|---|---|
| ||
Click the "Timeout" column to configure the time for transmission and reception of data packets. | ||
Expand | ||
| ||
Nodes configuration
Nodes refer to an the individual representation of each physical device on the platform. Its Their purpose is to uniquely identify and address devices uniquely, allowing individual access and control.
Creating a Channel channel within the Solution solution is the only requirement for configuring a Node on node in the Devices module.
To create a new Nodenode, follow the these steps:
- On In the Solution Designer, go to Devices → Nodes , and click the Add "New" button to open the Create New Node screen.
- Select the previously created channel and click "OK."
It This will insert a new line in the Nodes data grid.
Expand | ||
---|---|---|
| ||
After that, you must configure the PrimaryStation, to . To do this:
On the In Devices → Nodes, find the "PrimaryStation" columnPrimaryStation. This column contains the network IP and port necessary needed to find locate the device into on the network. Into In the specific node you created Node, on thePrimaryStation cell there is has a comboBox combo box to help assist with this configuration.
Expand | ||
---|---|---|
| ||
Click the "Settings" column to configure the network IP and port needed to locate the device on the network.
|
Note |
---|
The PrimaryStation configuration can change according to each protocol. |
Points configuration
Points refer to specific tags within a device, information units such as a temperature value , or an engine start command. Its Their purpose is to allow granular access to device data and functionalities, enabling the monitoring and controlling control of each pointPoint.
Creating a Node within the Channel and having a tag are the only requirements for configuring a Point on the Devices module.
To create a new Point follow the steps:
- On
In the Solution Designer, go to Devices → Points, click on the first line of the data grid, and insert the tag name.
- On
In the Node column, select the target Node and press Enter.
It will insert a new line in the Pointsdata grid.
Expand | ||
---|---|---|
| ||
Some Additionally, there are some configurations accessible through the Points data grid, such as Address, DataType, AccessType, Modifiers, Scaling, and more, but they are optional and detailed at the Additional configurations section.in the following:
Expand | ||
---|---|---|
| ||
Modbus Protocols
The Modbus communication protocols allow data exchange between a master and a slave. The master-slave principle is a model for a communication protocol in which one device (the master) controls one or more other devices (the slaves). A standard Modbus network can have one master and many slaves. Each side uses a different protocol, which means that the master protocol defines the communication for the master and the slave protocol does the same for the slaves. Because of this, there is one protocol for the Master and another for the Slaves. Both are available on the software platform.
You can check and manage which protocols are available by clicking on the Product Series on the Solution Manager. You can check it on the Solution Designer, too. To do this, go to Devices/Protocols or Devices/Channels. Both interfaces allow you to start the device configuration by creating a channel using a target protocol.
Modbus Master Configuration
The Modbus Master protocol dynamically creates blocks based on the AccessType configurations set for each data point. It allows for selecting message encoding types such as ASCII, RTU, or RTU TCP - a combination of RTU and TCP/IP. It is worth noting that TCP/IP and UDP/IP are transport layer protocols in the OSI model.
The Modbus Master Protocol supports serial, multi-serial, and TCP/IP interfaces. It results in slight differences in some attributes for each supported interface. For example, considering the Modbus Master Protocol, the Settings column presents different parameters according to the selected communication interface. It happens on the Nodes, where the PrimaryStation settings differ according to each protocol. However, generally, the procedure is very similar, and most settings are the same.
Expand | ||
---|---|---|
| ||
| ||
Click the Address column to configure the operand and address. Operand: Indicates the memory area. To select click the arrow to the right: Operand options: 0 Coils - Variable number of digital outputs 1 Input Status - Variable number of digital inputs 3 Input Registers - Variable number of input records 4 Holding Registers - Variable number of records Address: Indicates the address of the data on the memory, and can range from 1-65535. E.g.: 40001 (Operand = Holding Register, Address = 1) 30001 (Operand = Input Register, Address = 1) 01001 (Operand = Input Status , Address = 1) 00001 (Operand = Coils, Address = 1) |
Expand | ||
---|---|---|
| ||
Click the Address column to configure the DataType. |
Expand | ||
---|---|---|
| ||
Click the AccessType column to set the Read, Write or both. |
Additional configurations
The additional configurations refer to settings that allow protocol fine-tuning.
Expand | ||
---|---|---|
| ||
Modbus Simulator
The Modbus Simulator is a tool for testing communication drivers. It simulates interactions between a software platform and field devices or other automation systems on a Modbus TCP/IP network. This ensures that components can communicate before deployment in a production environment.
In a Modbus network, a Channel is a communication path established by the Master to manage interactions with Nodes. The simulator enables the creation and Node configuration of Nodes, allowing test testing of network scenarios and topologies without needing a physical network.
Each node within the network represents a device or a logical entity capable of communication via the Modbus protocol. Nodes can be configured within the simulator with communication properties such as IP addresses, ports, and device IDs. This feature allows for testing of the integration and communication among devices and nodes without a physical environment.
Configuring and testing
The PrimaryStation defines the essential parameters for communication with a target device. In the context of this tutorial, the Modbus Simulator emulates a Master device in the Modbus Network.
Follow the steps to test communication:
Step 1: Run the Modbus Simulator before starting.
To run the Modbus Simulator:
On Solution Designer, use the Solution Explorer to navigate to:
A. Devices/Channels: select a Channel created using the Modbus Master Protocol;
B. Devices/Nodes: select a Node linked to the created Modbus Channel;
The Modbus Simulator button will appear on the top of the data grid. Press the button to start the simulator.
Expand | ||
---|---|---|
| ||
Expand | ||
---|---|---|
| ||
Step 2: Configure and test PrimaryStation.
To configure the PrimaryStation:
On Solution Designer, use the Solution Explorer to navigate to Devices/Nodes:
Select a Node linked to a created Modbus Channel;
Click the PrimaryStation cell to edit;
Change the default IP address
[192.168.0.1]
to[127.0.0.1].
Press the Test button to test.
Expand | ||
---|---|---|
| ||
Testing on Runtime
You can use a display to view and interact with device data to test communication with the device during the solution runtime. You can include the Test test tag that will reflect the data from a Modbus device and configure a "Set Value" action for the Test test tag. It This will enable the manual setting of a new value to the Test test tag, helping to verify the communication between the Solution solution and the device.
Expand | ||
---|---|---|
| ||
Diagnostic Tools
Diagnostics Diagnostic tools refer to the include Property Watch, Trace Window, and Module Information. These tools help identify communication blocks and , address errors, allow provide property access to pinpoint error causes, and display system messages for device management and troubleshooting, offering a comprehensive approach to device management managing and troubleshooting for Solutions solutions on the software platform.
Module Information
This tool provides insights into module operations and communication channels, offering information about virtual reading groups, error codes, and communication events. It helps users identify communication blocks and effectively address errors in industrial automation systems.
Property Watch
This tool enables users to access, read, and write tags and internal properties of the system. It assists in identifying the root cause of errors through negative error codes, allowing for real-time adjustments and optimizations to the system configuration.
Trace Window
This tool displays system messages in a data grid interface, providing information about the status of reads, writes, and communication frames. It is particularly useful for various PLCs and communication protocols, as it presents invalid addresses in the configuration, assisting in device management and troubleshooting.
In this section:
Page Tree | ||||
---|---|---|---|---|
|