Connecting Third-Party Device (Master) to Controller (Slave)

The basic procedure largely corresponds to the description in Connecting Controller (Master) to Fieldbus Coupler (Slave). The main difference is that you only configure the Modbus data points in the data point configurator of the controller (slave) in e!COCKPIT. The connections are configured in the software of the higher-level third-party controller.

Place Devices on the Communication View

  1. Select a controller from the product catalog and use the mouse to drag it into the Network view (communication view).
  2. Third-party devices are represented in e!COCKPIT through generic devices, which you can also find in the product catalog:
    In the “Other Communication Parties” folder of the product catalog, select the generic Modbus master (“Generic_Modbus_Master”) under “Modbus TCP” or “Modbus UDP” and drag it into the Network view as well.
Drag Devices into the Network View
Drag Devices into the Network View

Configure I/O Modules Used in the Device Detail View

Note: The Device Detail view is not available for third-party devices.

  1. Open the Device Detail view (in either graphical and tabular view) by double-clicking the controller.
  2. Arrange the I/O modules used analogously to your hardware by dragging them from the product catalog and positioning them after the device.
  3. Drag I/O Modules into the Network View
  4. Parameterize the I/O modules as needed by selecting them and making changes on the “Settings” panel for each.
  5. Go back to the Network view.

Connect Devices

  1. Click the gray connector (ETHERNET/Modbus) for one of the devices in the Network view (communication view) and hold down the mouse button.
  2. To connect the devices to each other, drag the connection line to the same type connector on the second device. Release the mouse button as soon as a green plus sign appears.
  3. Connect Devices
  1. The devices are connected. The arrow of the connection line indicates the automatically assigned roles of the device: The connection line starts at the master and ends at the slave.
Direction of Communication: Master → Slave
Direction of Communication: Master → Slave

Set the Protocol for the Connection

  1. To set the protocol for the connection, click the [Protocol] button in the context menu of the Modbus connector or connection.
  2. Select the desired connection (in this example: “Modbus (TCP)”).
  3. Select Protocol

The selection options depend on the devices used.

Make the Device Settings on the “Settings” Panel

You can change the settings or parameters of the devices that have been added on the “Settings” panel. The panel is open by default. If it is not, open it using the context menu of the device and the [Settings] button.

Open the “Settings” Panel
Open the “Settings” Panel
  1. Select the device in the network view.
  2. The tabs, entry screens and selection fields on the “Settings” panel depend on the specific device. The settings options displayed depend on the content of the particular device description file.
  3. Third-Party Device (Master):
    Third-party devices tend not to have any possible settings. If modifiable settings are displayed, then they are merely for communication with the controller, but they are not modified in the third-party device itself.
  4. Controller (Slave):
    Make all the general settings concerning the device, PLC and local bus on the first tabs. For example, you can modify the IP address.
    Make Modbus settings on the “Modbus” tab.
  5. Make General Modbus Settings

Program Application

  1. Select the controller (slave).
  2. Open the “Program Structure” panel by clicking the [Program Structure] button on the “VIEW” tab of the menu ribbon.
  3. Open “Program Structure” Panel
  4. Create your program (in the main “PLC_PRG” program or in a POU).
  5. Compile and validate your program on the “PROGRAM” tab with [Compile].

Configure Slave

You configure the slave in the data point configurator.

  1. To switch to the data point configurator, double-click the Device tile of the slave device.
  2. The Device Detail view appears. The Modbus data point configurator opens on the “Modbus Slave” tab of the Device Detail view.
  3. Open Data Point Configurator
  4. Now specify which data points the slave should make available via the fieldbus. The following options are available and are explained below:
    • Use existing variables from the application
    • Use variables from I/O modules
    • Create generic data points
    • Make the data points that have been created available to the third-party controller

Use Existing Variables from the Application:

Since a programmable device is used as a slave in this case, the slave’s data points consist of variables of the slave application, among other things. These can be selected and created directly from the application.

  1. In the context menu, click [Add from Program].
  2. Select an existing variable from the slave’s application.
  3. Note: Simple data types are transferred directly via Modbus, while complex data types (including structures) are mapped to word arrays. These are then transferred via Modbus instead. If the data type used is known globally in the project, the master can directly access the individual elements of the complex variables, although Modbus does not use such a data type itself (see also Access to Simple and Complex Data Types).
  4. Select Variable from Application
  5. Transfer this with [OK].
  6. Select the direction of communication (Input, Output or Input / Output).
  7. Select Direction of Communication
  1. You can use the new data point.

Use Variables from I/O Modules:

  1. In order to use variables from I/O modules of your application, first switch to the “Local Bus I/O Mapping” tab in the data point configurator.
  2. In the Device Detail view, select the I/O module whose variables you want to access.
  3. Select I/O Module
  4. Create variables for the individual channels of the I/O modules (here “var1” and “var2”).
  5. Create Variables
  6. These variables are available globally.
  7. Switch back to the data point configurator by clicking on the controller and then on the “Modbus Slave” tab.
  8. In the “Program variables” context menu, click [Add].
  9. Add Variables
  10. A new data point, “ModbusDataPoint,” is created.
  11. Switch to the slave’s application and assign the local bus variable of the I/O module to the data point that was created.
  12. Mapping the Local Bus Variable to the Data Point

Note

Always map variables of I/O modules via newly created data points!

For variables of I/O modules, use the [Add] button (as described above), not [Add from Program].
Although you can also select the variable with [Add from Project] (the variable is shown under “Program variables”), this method does not allow access, since the variable is already accessed via the local bus. .

When you click [Generate Code], a corresponding message is output in the message window:

var1: map to existing variable with address is not allowed!

Therefore, only use [Add from Program] for application variables, not for variables of I/O modules.

Create Generic Data Points:

There are applications in which it makes sense to use generic data points. For example, you can group multiple data points into one register. You can then access them from different masters without having to create manual channels for every access point in the master.

  1. To create new generic data points, click [Add] in the context menu of “Generic Data Points.”
  2. Add Generic Data Points
  3. If necessary, change the data type and Modbus address.
  4. Select Data Type and Modbus Address
  5. In the context menu of the variable, click [Edit] and, if necessary, modify further settings, such as function code settings.

Note: Generic data points are not available via the slave application.

Make Data Points that Have Been Created Available to the Third-Party Controller:

On the “MODBUS SLAVE” tab of the menu ribbon, you can export the data points that have been created in batches to a CSV file in order to make the data available to the third-party device:

  1. Select the slave.
  2. Click the [Export] button on the “MODBUS SLAVE” tab of the menu ribbon.
  3. Export Data Points
  1. A CSV file is created.

Configure Connection between Master and Slaves

The connections are configured, not in e!COCKPIT, but rather in the software of the higher-level third-party controller.

  1. Import the CSV file that was created previously in e!COCKPIT into your third-party controller. This may require you to first convert it to a supported format.