Modbus Connection

Creating a Modbus Connection

To create a Modbus connection, proceed as follows:

Step

Action

1

In the Connections view, right-click inside the table and run the Modbus command from the contextual menu.

Result: A new row is added to the table with Protocol = Modbus.

2

Select this row and configure the connection in the Properties view.

3

In the Communication section:

  • For the parameter IP Address, enter the IP address of the Modbus server.

  • For the parameter Port Number, enter the number of the port (by default, 502).

4

To configure a Modbus address for this Modbus connection, you can create, for example, a Kinematic Axis Motor in the Solution Explorer and configure the Forward variable in the Properties view to be provided by the controller.

From the Source parameter list, select the Modbus register type: Coils, Discrete Inputs, Holding Registers or Input Registers, then:

  • Enter a Modbus Address, for example, 1.

  • Enter a Modbus Bit No., for example, 0.

5

In the Connections view, right-click the row you created for the Modbus TPC connection, and run the Connect command from the contextual menu.

Result: The message Insecure Connection is displayed because Modbus communication is not encrypted.

6

To establish a Modbus connection, click Yes.

Result: After the connection to the controller is established, you will see Status = Connected displayed in the Modbus connection row within the Connections view.

Modbus-Specific Commands of the Connections View

When you right-click the Modbus connection in the list, the Connections view provides the following Modbus-specific commands in the contextual menu:

Command

Description

Enable Logging / Disable Logging

To create a log file for Modbus communication with the selected controller, run the Enable Logging command. This creates a log file in the folder %localappdata%\Schneider Electric\Machine Expert Twin\2\Work\Logs.

Run the Disable Logging command to stop writing log entries to this file.

Truncate Log

Run the Truncate Log command to write truncated log entries to the Modbus log file.

Import (PLC x)

Run the Import (PLC x) command to open an Import Schneider configuration dialog box that allows you to browse your file system for an *.XSY file for importing an address configuration.

Show PLC Inputs / Show PLC Outputs

Run the Show PLC Inputs / Show PLC Outputs commands to open separate Inputs and Outputs views for monitoring.

The Show PLC Inputs / Show PLC Outputs commands are only visible in the contextual menu when you are connected to a Modbus TCP server and input addresses or output addresses are configured in your project.

To configure the update frequency and to switch from the table to the tabbed view, see Modbus-Specific Settings in the Properties View.

Cleanup Addresses

Run the Cleanup Addresses command to remove the addresses configured for this connection. A confirmation dialog box is displayed; click Yes to remove the addresses.

Alarms

Run the Alarms command to open the Alarm Scheme dialog box. Click Add to add an alarm for a specific Address and Bit and enter text in the Description field. Your description is displayed in the Alarms view when the alarm is detected at the configured Address and Bit for the connection. In the status bar at the bottom of the Model view, the describing text is also indicated when the alarm is detected and is extended by the connection name.

Modbus-Specific Settings in the Properties View

The following settings of the Properties view are specific to Modbus connections:

Parameter

Description

I/O Window

Update Frequency

Enter a value (in ms) specifying the update interval for the values displayed in the I/O monitoring (Show PLC Inputs and Show PLC Outputs) views.

Default value: 500 ms

NOTE: Consider the impact this polling frequency can have on the performance of the Modbus server when modifying the value.

Tabbed I/O Window

Select this check box to display the values in the I/O monitoring views in a tabbed view instead of the default table view.

Tab Size

When the Tabbed I/O Window check box is selected, enter a value defining the number of addresses per tab.

Default value: 100 addresses per tab

Addressing

Word Swap Enabled

Configure the interpretation of data types that use more than one WORD size according to the little endian or the big endian convention. This setting must comply with the convention used by the Modbus master.

Default value: The check box is cleared. Data types requiring two WORD size are interpreted according to the little endian convention.

Example: The addresses of the axis positions of the Lexium Cobot are of data type REAL and thus require two WORD size. The two WORD data fields are provided according to the big endian convention. Thus, for communication with the Lexium Cobot, select the check box.

Communication

Port Number

Enter the port number for the Modbus connection (by default, 502).

IP Address

Enter the IP address of the Modbus master server.

Slave

Address

Enter an address value if a specific value is required by your Modbus master server. Otherwise you can leave the default value 255 unchanged.

Value range: 1...255

For a description of the general settings, refer to General Parameters of the Properties View.