With the continuous development of computer control technology, the application of editable logic controllers is also becoming increasingly popular, becoming an
important component of automation technology. Among them, Siemens S7 series PLCs also account for a large proportion in industrial control in China. As an intuitive
and convenient way of human-computer interaction, touch screens have been widely used in industrial control. In the long-term use process, the author found that
many people are unfamiliar with data communication between different models of PLCs, as well as between Siemens PLCs and third-party touch screens. This article
will use specific examples to illustrate how to use Ethernet to achieve communication between MCGS touch screens and Siemens S7 series PLCs, laying the
foundation for industrial automation control systems.
1 Hardware composition
The hardware of this control system consists of three Siemens S7 series PLC modules, one of which uses a typical S7-300 series CPU314C-2PN/DP PLC as
the master station, and the other two choose S7-200Smart series SR40 and ST30 PLCs as the slave stations. The touch screen uses Kunlun
Tongtai's TPC7062Ti (with Ethernet port), which only communicates with the master station PLC, while the master station can communicate with two
slave stations, and communication can also be conducted between the two slave station PLCs. Three PLC modules are connected using Ethernet cables and
switches, and IP addresses are set for each PLC through programming software. In addition, IP addresses need to be set for the touch screen and programming
computer. Note that all devices in this system must have IP addresses in the same network segment. The hardware composition and IP allocation of the system
are shown in Figure 1.
Figure 1 System hardware composition and IP allocation
2. Upper unit network
2.1 S7-300PLC Ethernet Settings (1) Hardware and Network Configuration
The CPU adopts 314-2PN/DP and uses STEP7 Manger V5.5 software. One S3-300 station is inserted, and CPU14-2PN/DP is inserted into the hardware configuration.
The hardware parameters of the hardware configuration must be the same as the actual hardware parameters, because CPU14-2PN/DP comes with two
Ethernet PN interfaces. When configuring, an Ethernet property setting window will pop up. In this window, set the IP address according to Figure 1,
select not to use the router (ordinary switches do not have IP addresses), create a new Ethernet (1) subnet, and after the hardware settings are completed,
click save and compile to create system data.
(2) Network configuration
Open "NetPro" to set network parameters, select CPU 314-2PN/DP, insert two new connections in the connection list, select "Connection Partner" (unspecified),
"Site" (unspecified), select "S7 Connection" as the connection type, check "Establish Active Connection" for the local connection endpoint in the property settings,
and select "Block Parameters". As S7-300 needs to communicate with ST30 and SR40 of S7-200Smart series PLC, they can be set to "1" and "2" respectively.
Type the IP address of the relevant PLC in the partner column, and set it to "192.168.0.2" and "SR40" respectively according to Figure 1
192.168.0.3 ", the address bar is set to the IP address of S7-300
192.168.0.1 ", then click on the address details, partner bar rack/slot
The slot number needs to be changed to 1, confirm, create network configuration, compile without errors, and then download.
2.2 Smart200 PLC Ethernet Settings
The Smart200 PLC (including ST30 and SR40) uses STEP 7 Mi croWIN SMART V2.2. Open "System Fast" in the software, select the corresponding module on the CPU,
and set the IP address and parameters according to the system hardware composition and IP allocation in Figure 1, as shown in Figure 2
Show. After setting up, in the "Communication" dialog box, you need to select a network interface card that matches the type of programming computer network card.
Use "Find CPU" to select different IP addresses that match the PLC to download the Smart200 PLC IP address parameter settings program as shown in Figure 2.
Figure 2 Smart200 PLC IP Address Parameter Settings
Ethernet communication between Smart200 PLCs using GET/PUT wizard
Implementation: Open the GET/PUT wizard dialog box, add the name "Operation1" as the GET type in the operation, set the transfer size to 100, set the remote IP
of the remote CPU to SR40's IP address: 192.168.0.3, and set both the local and remote addresses to 200. Implement the transfer of data from VB200~VB299 in SR40
to VB200~VB299 in ST30; Operation2 is of PUT type, with the same transmission size and remote IP settings for the remote CPU as Operation 1. The local and remote
addresses are set to 300, enabling the transfer of data from VB300~VB399 in ST30 to VB300~VB399 in SR40. In this way, a block is divided between ST30 and SR40
for data exchange. It must be noted that when setting up the wizard, click on the wizard
Memory allocation ", each configured network requires 20 bytes of V memory for operation, which cannot be connected to the memory divided for data exchange
Address overlap, you can set an unused block address as the starting address through 'suggestion'.
2.3 MCGS Touch Screen Ethernet Settings
After powering on, the touch screen can be continuously clicked to enter the system settings. The IP address can be modified in the "Set System Parameters" section
of the system maintenance. MCGS
When the touch screen adopts Ethernet networking, add a
Universal TCP/IP parent device "and a" Siemens CP443-1 driver "child
Device, set the local IP to the programming computer IP in the parent device
192.168.0.5 ", set the remote IP address to touch screen IP
“192.168.0.4”; Set the local IP to touch screen IP in the sub device
192.168.0.4 ", set the remote IP address to the main station S7-300 IP
“192.168.0.1”。
3 Control requirements
The system requires communication detection between the touch screen and three PLCs to be completed. When three PLCs are powered on and in operation, if the
system network connection is normal, the corresponding communication indicator light on the touch screen will light up. In addition, each PLC needs to be assigned
an output point as a communication test light. Test in two scenarios:
(1) Communication test between 3 PLCs: Press the SB1 button (master station), and the communication test light at the output point of the slave station PLC will
turn on; Press the SB1 button again, and the communication test light at the output point of station one PLC will remain on, while the communication test light at
the output point of station two PLC will be on; Press the SB1 button again, and the communication test light at the output points of station one and two PLCs will
turn off, completing the first type of communication test.
(2) Communication test between touch screen and 3 PLCs: Design a test box on the touch screen, input (10) in the test box, and the communication test light at the
output point of the main station PLC will light up; Input (20), the communication test light of the main station and one PLC output point of the slave station lights up;
Input (30), the communication test lights of the PLC output points of the master station, slave station 1, and slave station 2 are on; Enter other values, and all
communication test lights will turn off.
4. Human Computer Interface Design
According to the control requirements, the human-machine dialogue interface needs to be equipped with three output indicator lights, namely the communication
indicator lights for the master station, slave station one, and slave station two; A test box with attribute variables as shown in Table 1. The MCGS touch screen can
be implemented using insert component components and input box components in the toolbox of the user window, and its variables can be set in the operation
properties. And the interface can be explained and beautified using the straight lines and label components in the toolbox, as shown in Figure 3.
Figure 3 Human Computer Interface Design
5 Program Design
5.1 Input and output allocation of PLC
From the perspective of control requirements, the system only has one input button, and an input point is assigned by S7-300; Three PLCs are each assigned an
output point for communication testing lights, as shown in Table 2.
5.2 Communication Program between S7-300 and Smart200
In S7-300, two blocks, FB14 and FB15, can be called to perform read and write operations on data in Smart200 PLC. First, set FB14 and FB15 as DB14 and DB15,
with ID W # 16 # 1, as shown in Figure 4. Program segment 1 in Figure 4 is a read instruction, which reads MB21 from station ST30 to MB12 from station S7-300 at
the rising edge of M0.0; Program segment 2 is a write instruction that, on the rising edge of T1, writes MB10 from the master station to MB20 from the slave station.
图4 读写操作指令
The program segment shown in Figure 5 represents FB14 and FB15 using timing for reading and writing. T2 is delayed by 100 ms, and M0.0 coil is powered on for reading operation; T1 starts with a delay of 100 ms, and when the time is up, write operations begin.
图5 定时读写
Similarly, set FB14 and FB15 as DB16 and DB17, with ID W # 16 # 2, to complete the reading of MB31 from SR40 in station 2 to MB13 in S7-300 of the main station, and write MB10 from the main station to MB30 in station 2. 5.3 Implementation of S7-300 Functions in the Main Station
图6 计数启动
图7 触屏数据启动 图8 主站通信指示灯点亮
As shown in Figure 6, the program starts counting by recording the number of times SB1 is pressed through a counter, and using a comparator to start different states M1.0 M1.1、M1.2; As shown in Figure 7, the touch screen data is activated. This program transfers the data from the touch screen test box to S7-300 and uses a comparator to activate different states M1.3 based on the touch screen input data M1.4、 M1.5。 M1.3, M1.4, and M1.5 all activate the communication indicator light Q136.0 at the output point of the main station PLC, which can be implemented using the program shown in Figure 8; M1.0, M1.1, M1.4, and M1.5 activate the communication indicator lights at the output point of the slave station one PLC, and M1.1 and M1.5 activate the communication test lights at the output point of the slave station two PLC. This is achieved using the program shown in Figure 9. Since the test light signal data of slave station one and slave station two need to be transmitted to ST30 and SR40 respectively, data M10.0 and M10.1 are used in the program shown in Figure 9. M10.0 corresponds to the data transmitted to ST30 as M20.0, and M10.1 corresponds to the data transmitted to SR40 as M30.1. As shown in Figure 10, when S7-300 is powered on, the communication indicator light of the touch screen main station lights up.
Figure 9: Starting of the communication indicator light at the slave station
Figure 10: The communication test light of the main station is started
5.4 Slave Station Program Design
Smart200 ST30 and SR40 are two slave stations respectively. If they communicate with each other, they also need to call the execution subprogram NET_EXE in the
ST30 main program block as the local CPU in the slave station, as shown in Figure 11. As shown in Figure 12, the program implements the power on lighting of M21.0,
which can be transmitted to M12.0 of S7-300, thereby causing the communication indicator light of the touch screen slave station to light up; And M20.0 comes from
M10.0 of S7-300, which can light up the output point Q0.0 of ST30, realizing the lighting of the communication test light from station one. Similarly, the communication
indicator light and communication test light of station two can be illuminated.
Figure 11: Calling the NETEXE Subroutine 图12 ST30 中程序
6 Conclusion
This article provides a detailed example of the upper computer S7-300, S7-200Smart PLC, and MCGS touch screen Ethernet settings, human-machine interface design
and component attribute settings, S7-300 and S7-200Smart PLC program functions, and realizes Ethernet communication testing between MCGS touch screen and
different PLC models of Siemens S7 series, laying the foundation for different industrial automation control systems.
Mobile: (+86) 15606940871
Email: zhddqjt@gmail.com