In actual work environments, PLCs may communicate and exchange data. Typically, communication requires devices to be on the same network segment. However, what if our devices are not on the same segment? This article introduces how two PLCs can perform TCP/IP communication to exchange data when they are not on the same network segment.
Open the TIA Portal project, create the “PLC_1” device, add CPU1215, and set the IP address, subnet mask, and system clock as shown in Figures 1 and 2.
Figure 1
Figure 2
Create the “PLC_2” device, add CPU1215, and set the IP address, subnet mask, and system clock as shown in Figures 3 and 4.
Figure 3
Figure 4
In “PLC_1”, add DB3 and DB4 data blocks (as shown in Figures 5 and 6) for storing and sending data. Both sending and receiving data are 100 bytes in length. Note: The data types for sending and receiving are arrays and are non-optimized access blocks.
Figure 5
Figure 6
In “PLC_1”, program in the OB1 main program block.
① Add the “TCON” instruction and click the configuration icon, as shown in Figures 7 and 8.
Figure 7
Figure 8
② Add the sending and receiving data instructions, as shown in Figure 9.
Figure 9
In “PLC_2”, add DB3 and DB4 data blocks (as shown in Figures 10 and 11) for storing and sending data. Both sending and receiving data are 100 bytes in length. Note: The data types for sending and receiving are arrays and are non-optimized access blocks.
Figure 10
Figure 11
In “PLC_2”, program in the OB1 main program block.
① Add the “TCON” instruction and click the configuration icon, as shown in Figures 12 and 13.
Figure 12
Figure 13
② Add the sending and receiving data instructions, as shown in Figure 14.
Figure 14
Simulation testing, as shown in Figure 15.
Figure 15
Source: Jicheng Training Network, Author: Guo Biao, unauthorized reproduction is prohibited~
Exclusive for fans
【Complete Siemens Materials】
Previous Recommendations
Siemens S7-1200 PLC Water Tank Level Control Program Case
5 Project Cases for Quick Entry into C# Host Development~
Confused about switching, analog, and pulse quantities? The most comprehensive programming algorithms for PLCs explained, understand thoroughly after reading!
One trick to quickly replace the drawing frame made in Solidworks
How to control the EtherCAT bus with Inovance Servo? Only experts know!
40 images to help you understand power supply system diagrams, all done in 5 minutes!
How to download TIA Portal WinCC Advanced projects?
64 Essential Siemens E-books for Learning Automation | Free to Receive
Three common shortcut methods to exit sketches in Solidworks, which one do you prefer?