Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The Modbus Tutorial explains how to configure platform-to-device communication using the Modbus protocol. In the software platform, the Devices module manages communication with field devices through Channels, Nodes, and Points, allowing stable and secure data exchange between multiple devices across different networks.

The concepts presented apply to all communication drivers. You can define multiple protocol interfaces using abstraction layers like Channels and Nodes. The main difference between protocols is the syntax 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 on what to do if you require a device protocol not listed on your system.

On this page:

Table of Contents
maxLevel3
stylenone


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:

  1. 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.

  2. 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

Protocols define communication rules between the platform and devices. Channels define global parameters for the use of a communication protocol. Nodes represent 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). All initial configurations for devices in the solutions on the software platform follow this workflow:

  1. Define a Channel using a target communication Protocol. It will create the base instance for linking a Node;

  2. Define the Node linked to the created Channel;

  3. Define the Point that you want to monitor.


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:

  1. 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:

    1. 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.

    2. Go to Devices → Channels, click the Add button on the grid's top-left to open the Create New Channel dialog.

  2. In the Create New Channel dialog:

    1. Select the Modbus Master Protocol.

    2. Choose a name for the Channel.

    3. Select the interface. For this tutorial, select TCPIP.

    4. Press the OK button to create a Channel using the selected protocol.


Expand
titleCreating a Channel


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, which are detailed in the following sections:


Expand
titleProtocolOptions

Click the "ProtocolOptions" column to define specific parameters for the protocol information that will be used.

  • BlockSize: Sets the maximum number of items per group, the default value is 250.

  • Encoding: Determines how information is encoded/sent. To select just click the arrow next to:

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.

  • SingleWrite: Indicates the behavior of information written with only one item. To modify this behavior, just click the arrow to the right:

  • SlaveID: Device slave address on Modbus network. Can be used for addresses 1-247.

  • CoilWriteValue:

  • Offset address:



Expand
titleSettings

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
titleSettings for TCP/IP



Expand
titleSettings for Serial



Expand
titleSettings for Multi-serial







Expand
titleTimeout

Click the "Timeout" column to configure the time for transmission and reception of data packets.



Nodes configuration

Nodes refer to the individual representation of each physical device on the platform. Their purpose is to uniquely identify and address devices, allowing individual access and control.

Creating a channel within the solution is the only requirement for configuring a node in the Devices module.

To create a new node, follow these steps:

  1. In the Solution Designer, go to Devices → Nodes and click the "New" button to open the Create New Node screen.
  2. Select the previously created channel and click "OK."

This will insert a new line in the Nodes data grid.


Expand
titleCreating a Node


After that, you must configure the PrimaryStation. To do this:

In Devices → Nodes, find the "PrimaryStation" column. This column contains the network IP and port needed to locate the device on the network. In the specific node you created, thePrimaryStation cell has a combo box to assist with this configuration.


Expand
titlePrimaryStation

Click the "Settings" column to configure the network IP and port needed to locate the device on the network.

  • IP: In this case, because we will use the simulator on the same machine as the solution, the IP can be the localhost IP: 127.0.0.1, but if you have a physical device on your network, you can use the IP from there.
  • Port: We will use the default port 502. Generally, each protocol has our default port.


Note

The PrimaryStation configuration can change according to each protocol. 



Points configuration

Points refer to specific tags within a device, such as a temperature value or an engine start command. Their purpose is to allow granular access to device data and functionalities, enabling the monitoring and control of each Point.

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:

  1. In the Solution Designer, go to Devices → Points, click on the first line of the data grid, and insert the tag name.

  2. In the Node column, select the target Node and press Enter.

It will insert a new line in the Pointsdata grid.


Expand
titleConfiguring a Point



Some configurations accessible through the Points data grid, such as Address, DataType, AccessType, Modifiers, Scaling, and more, are detailed in the following:


Expand
titleAddress

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
titleDataType

Click the Address column to configure the DataType.



Expand
titleAccessType

Click the AccessType column to set the Read, Write or both.

Expand
titleConfiguration overview

Image Removed



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 configuration of Nodes, allowing 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 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.

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
titleA. Starting Modbus Simulator on Devices/Channels



Expand
titleB. Starting Modbus Simulator on Devices/Nodes


Step 2: Configure and test PrimaryStation.

On Solution Designer, use the Solution Explorer to navigate to Devices/Nodes:

  1. Select a Node linked to a created Modbus Channel;

  2. Click the PrimaryStation cell to edit;

  3. Change the default IP address [192.168.0.1] to [127.0.0.1].

  4. Press the Test button to test.


Expand
titleInstructions for PrimaryStation configuration and test



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 tag that will reflect the data from a Modbus device and configure a "Set Value" action for the test tag. This will enable the manual setting of a new value to the test tag, helping to verify the communication between the solution and the device.


Expand
titleCommunication tests on Runtime



Diagnostic Tools

Diagnostic tools include Property Watch, Trace Window, and Module Information. These tools help identify communication blocks, address errors, provide property access to pinpoint error causes, and display system messages for device management and troubleshooting, offering a comprehensive approach to managing and troubleshooting 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 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
root@parent
spacesV10