Tag communication
Tag communication is mainly used for data exchange between controller layers. Controllers (including PLCs, touch screens, robot controllers, motion controllers, etc.) do not communicate with each other using actual memory addresses, but directly use tag variable names.
In particular, the use of tag communication between the touch screen and the PLC makes data exchange more intuitive and convenient.
The following example, using the communication between MC532 and LT2100T, illustrates the method of tag communication.
PLC configuration
1. Create a new project example_MC532_Tag Communication. Right-click on "Application" in the device tree on the left, and then select "Add Object" → "Symbol Configuration" from the drop-down menu, as shown in Figure 1 below;
Figure 1. Adding "Symbol Configuration"
2. After the window shown in Figure 2 pops up, check the "Support OPC UA" feature;
Figure 2: Select "Support OPC UA"
3. Create new variables and programs in PLC_PRG as shown in Figure 3; then double-click "Symbol Configuration" in the device tree on the left to open the symbol configuration page, and then compile the project, as shown in Figure 4.
Figure 3 Example of PLC_PRG program
Figure 4. Opening the "Symbol Configuration" page
4. Then select the variables that need to be used for tag communication (all variables are selected in the example below, but in actual use, only select the necessary variables), and then click "Generate Code," as shown in Figure 5 below. This will compile and generate an XML file for tag communication. Leadsys Studio (V2.1 and above) supports Chinese variable tags.
Figure 5. Selecting variables for tag communication.
5. Open the directory containing the "Example_MC532_Tag Communication" project. You will see the generated XML file, as shown in Figure 6 below. This XML file is used to import the tag communication variables for the touchscreen.
Figure 6. Viewing the generated XML document
At this point, the PLC configuration is complete. Compile the program, download it to the PLC, and run the PLC program.
II. Touchscreen Configuration
1. Open LT Studio V1.5 3 software, create a new HMI project "LT2100T_Tag Communication", select LT2100T, as shown in Figure 7 below;
Figure 7 LT Studio V1.5 3 software interface
2. Click Next, select Static IP Address Assignment, and set the touchscreen IP address to be on the same network segment as the PLC, as shown in Figure 8 below;
Figure 8 Setting the HMI IP Address
3. Click Next, select "Network PLC", click "Add", select the manufacturer "Leadshine", and the device type "Leadshine_EthernetTab"; set the PLC's IP address (the network port IP used by the PLC), the port number is 11740 by default and does not need to be modified, as shown in Figure 9 below;
Figure 9. Adding a new PLC and setting parameters
4. Click "Confirm" and wait for the new project to be generated; then click "Settings" in the menu bar → "Communication Settings" → "Local Connection", select "Network PLC", and double-click the device MC532; select the "Import Variables" label as shown in Figure 10 below;
Figure 10 Import Tags
5. Select the XML document generated during the PLC compilation process, as shown in Figure 11 below;
Figure 11 Selecting an XML file
6. Add a digital element to the touchscreen interface, select the corresponding label, choose re1 as the first option, and then confirm, as shown in Figure 12 below;
Figure 12 New digital components
7. Add components one by one and select the corresponding labels. The touch interface is shown in Figure 13 below;
Figure 13 Touchscreen Interface
8. Compile and download the touchscreen program to the touchscreen. Connect the PLC and touchscreen using a network cable. Click the switch on the touchscreen; the PLC's OUT0 and OUT1 lights will illuminate. This indicates that the touchscreen and PLC tags are communicating normally.
-END-