IO Debugging Methods

To debug third-party Profinet IO or Profinet gateways, use the online data monitoring function of configuration software, or verify debugging through Siemens platforms (STEP 7-MicroWIN SMART, TIA Portal) and Codesys.

1. STEP 7-MicroWIN SMART Platform

When debugging Profinet IO on the STEP 7-MicroWIN SMART platform, operation requires an S7-200 PLC. After importing the device description file (GSD), add the device via the "Profinet Configuration Wizard". Click the corresponding device (e.g., P31V1.0.0-p18 in the diagram) to query the PLC's register mapping address for the device. For example, the digital input (DI) of the P31-AXAX4040G-U is mapped to address %IB128, and the digital output (DO) is mapped to %QB128.

图片.png

Add the corresponding monitoring points to the "Status Icon" (as shown in the diagram).

图片.png

Download the program to the PLC, select "Debug" from the top menu, and enable "Chart Status" monitoring to control and switch the relay status of the P31-AXAX4040G-U online and query the discrete input status.

2. TIA Portal Platform

Similar to STEP 7-MicroWIN SMART, debugging third-party Profinet IO on TIA Portal requires connecting to a PLC first. TIA Portal does not support S7-200; instead, use S7-1200 or S7-1500 series PLCs. Add the third-party device in the device configuration interface and enter the device configuration interface to query mapped point data. For example, the DO of the P31-XXAX00A0G-U is mapped to %QB2 and %QB3.

When using the device's Modbus gateway function, configure the corresponding sub-module. For example, map 1 holding register for reading to %IW68, 1 holding register for writing to %QW64, and Modbus gateway control registers to %QB4-QB8, where Q4.0 is the serial port enable control (refer to the device manual for Modbus gateway control register functions).

Add the above variables to the "Monitoring and Forcing Table". After writing the program to the PLC, switch to "Online Mode" and enable variable monitoring to control the relay output of the P31-XXAX00A0G-U and its serial port to send Modbus commands via the variable table (enable %Q4.0 for the gateway function; otherwise, no serial port commands will be output).

图片.png


图片.png

3. Codesys Platform

In the Codesys platform, enable "Always Update Variables" in device configuration to facilitate modifying variable values in the "PNIO SubModule I/O Mapping" later, eliminating the need to create a variable monitoring table.

图片.png


Debugging on Codesys can be performed without connecting to a physical PLC for remote IO device debugging. After GSD import, add the corresponding IO module to the device tree and double-click to enter the device configuration to query mapped point data. For example, the DI of the P31-AXAX4040G-U is mapped to %IB3, and the DO is mapped to %QB0.

Add %IB3 and %QB0 to the variable monitoring table (after enabling "Always Update Variables", control can be performed directly in the IO properties interface). Configure input parameters in "Set Value" or "Prepare Value", and write the parameters to the device using Ctrl+F7.

图片.png

If connection issues occur, first check if the simulated PLC has been automatically closed due to timeout (locate the "Control Win SysTray" icon in the system tray, click "Start PLC", and wait approximately 3 seconds until the icon turns red, indicating activation). Restart the simulated PLC if necessary. (Note: Without authorization, ControlWin runs for 2 hours before the icon turns gray automatically.)

Gateway Function Usage

Currently, the gateway function only supports Profinet to Modbus RTU, with two roles: PNMB Master and PNMB Slave.

  • PNMB Master: The gateway acts as a master device to send Modbus RTU commands to control or query slave devices. This role is typically used to feed data from RTU devices (e.g., temperature, liquid level, pressure sensors supporting Modbus RTU) back to the PLC. The gateway converts Profinet commands from the PLC into Modbus RTU protocol.

  • PNMB Slave: The PLC acts as a slave device, feeding data back to the master device via the gateway. The gateway converts data sent by the Modbus master into Profinet commands to operate the PLC.

Case Study: A gateway device enables both PNMB Master and PNMB Slave modes to transfer data between two PLC addresses.

  1. Import the gateway device description file (GSDML-V2.3-EBYTE-PN1-D25) as per previous tutorials.

    图片.png

  2. Adjust the gateway's unique device name (use the default name here), add the device to the PLC project, and assign an IP address.

    图片.png图片.png

  3. Connect the network port to the PLC network.

    图片.png

  4. Add modules and record their mapped addresses in the PLC.

    图片.png

  5. Adjust the starting address of the PNMB Master write module to 1.

    图片.png

PNMB Master Configuration:

  • Configure Modbus Slave 40001 to 122; the PLC's %IW70 is synchronized to 122 via the gateway.

  • Configure the PLC's %QW66 to 0; the gateway modifies Modbus Slave 40002 to 0.

PNMB Slave Configuration:

  • Configure Modbus Poll 40002 to 111; the PLC's %IW68 is modified to 111 via the gateway.

  • Configure the PLC's %QW64 to 1111; Modbus queries 40001 via the gateway and returns 1111.

图片.png