Connecting Controller (Master) to Fieldbus Coupler (Slave)

In what follows, you will connect a controller to a fieldbus coupler. In this example, both devices are not scanned on the network, but instead first configured offline.

Place Devices on the Communication View

  1. Select a controller and a fieldbus coupler from the product catalog and use the mouse to drag them into the Network view (communication view).
Drag Devices into the Network View
Drag Devices into the Network View

Configure I/O Modules Used in the Device Detail View

  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. Parameterize the I/O modules as needed by selecting them and making changes on the “Settings” panel for each.
  4. Go back to the Network view.
  5. Proceed in the same way with the second device.

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. Make all the general settings concerning the device, PLC and local bus on the first tabs. For example, you can change the IP address.
  4. Make Modbus settings on the “Modbus” tab.
  5. Make General Modbus Settings

Program Application

  1. Select the controller.
  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.

However, the slave configuration is not relevant for fieldbus couplers, since the slave data points already result from the hardware setup. In this case, the data point configurator serves primarily to display the existing data points that can be made available to the master via the fieldbus configurator.

  1. To view the data points, open the data point configurator by double-clicking the Device tile.
  2. You can find the data points that result from the hardware structure under “Local Bus Data Points.” No further settings are necessary at this point, but you have the opportunity to rename data points by double-clicking the names.
  3. Rename Data Points
  4. Optional: If necessary, you can also add generic data points in the data point configurator. You need these if you want to access existing data points, which can represent any position in the existing Modbus process image, in a certain way (using function codes), for example. For creating and editing generic data points, see scenario Connecting Controller (Master) to Controller (Slave), “Create Generic Data Points.”

Configure Connection between Master and Slaves

You can configure the connection between the master and slaves in the fieldbus configurator. Here you primarily make connection settings, display variables to transfer and create new variables.

  1. Click the Modbus connector of one of the two connected devices.
  2. Open the Modbus fieldbus configurator by clicking the [Configurator] button.
  3. Open Fieldbus Configurator
  4. The fieldbus configurator opens. The connection is shown in the header section of the configurator. If multiple slaves are connected to one master, you can modify the selection under “Selected Connection.”
  5. The fieldbus configurator is divided into two columns:
    The left side shows the variables that are transferred from the slave to the master via the bus.
    The right side shows the data points available on the slave that result from the hardware setup of the fieldbus coupler. Standard variables that are automatically available to every Modbus slave (“WAGO Modbus special register”) are also shown here. The tree displays these in a hierarchical view corresponding to the program structure.
  6. In the right-hand column, select a slave data for the master to access.
    Tip: You can select multiple data points by holding down the Control key.
  7. Note: You can access both individual variables and entire structures/arrays. I/O modules can also be made available to the master as a whole with all data points. In this regard, see Access to Simple and Complex Data Types.
  8. Click [Map] in the context menu of the data point.
  9. Made Slave Data Point Available to Master
  10. The variable is generated in the master application. This establishes the connection to the slave data point.
  11. You see the slave data point (1), the variable that has been created on the master (2), the drop-down list for modifying the data type (3), the cycle time for updating variables via Modbus and (4) the type of Modbus access to the variables (5).

    ReadOnly (RO): Master reads the slave’s output
    WriteOnly (WO): Master writes to the slave’s output
    ReadWrite (RW): Master reads the output/writes to the input of the slave
  12. New Variable on the Master
  13. Change the cycle time (column T [ms]) to the required cycle time.
  1. You can now use the master variable in the master’s application.

Access Data Points

  1. Open the program structure and the main program of the master.
  2. Open the Master’s Main Program
  3. In the master’s application, the variable is accessed as shown in the following figure.
  4. Tip: Press the [F2] key to open the input assistant for easy variable selection.
  5. Access to the Variable in the Master Application
  1. In this way, an existing slave data point has been made accessible via Modbus and read out in the master application.