Siemens S1200 PLC Modbus TCP Configuration

Instruction for configuration Siemens S1200 PLC as Modbus/TCP Server (Slave)

1. Run TIA Portal and Create a new project.

2. Select a name and folder for the new project. Click Create.

3. Select the appropriate device or select Unspecified CPU 1200.

4. On the left side of the program window select the Device configuration menu and click detect on the main window.

5. In the additional window select Start search (please do not forget to connect your PLC to PC).

6. After searching choose the right PLC and click Detect.

7. After adding proper PLC to the main window make double click on its Ethernet port (with the prompt PROFINET interface_1 on the screenshot)to setup. Add IP address, Submask, and choose IP address is set directly at the device.

8. Go to PLC_1 -> Program blocks -> Main. On the right side of the window choose Communication -> Other -> Modbus TCP -> MB_SERVER. Select it and drag to Network 1.

9. Go to the Program blocks menu at the left side of the window and select Add new block. In the pop-up window choose Data block, add a name for it (in the example - ModbusConfigDB). Click OK.

10. In the new pop-up window add the next variables to the Data block (we can see its name ModbusConfigDB in the left menu):

  • CONNECT (type: BOOL);

  • MB_HOLD_REG (type: Array[0..20] of Int);

  • CONNECT (type: TCON_IP_v4, you need to fill additional lines InterfaceId - 64; ID - 1; ConnectionType - 11; ActiveEstablished - empty; RemoteAddress - set IP address of Modbus TCP Client; RemotePort - 502; LocalPort - 502);

  • NDR (type: BOOL);

  • DR (type: BOOL);

  • ERROR (type: BOOL);

  • STATUS (type: BOOL).

After adding all variables click the right-click of the mouse on this Data block (in the left menu) and select Compile -> Software (only changes).

11. Drag and drop each variable one by one from the table (a pop-up window from #10 of this tutorial) to the corresponding link on the MB_SERVER function block (a pop-up window from #8 of this tutorial).

The result must be the following:

12. Click COMPILE on the top of the program window.

After that click Download to device. Find the right PLC and Load a program.

13. You can monitor your connection from the online mode in TIA Portal (you can switch online and offline modes with the buttons at the top).

Variable Status will be 7006 if the connection is Ok. If not - summon TIA portal Help with F1 key.

Last updated