Technology Sharing

Case|LabVIEW connects to S7-1200PLC

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Comes with:
Wrote good reference articles:
Tutorial on connecting the communication test tool and the Botu simulator[Contains complete process with pictures and text + software usage]

Solve the problem that higher versions such as Botu V15 V16 V17 V18 and lower versions are incompatible on the same PLC


Preface

以下默认读者已经有LabVIEW、PLC软件的基本使用基础
Realize the communication function between LabVIEW and S7-1200PLC.
specific:
1) Check whether the connection is successful (indicated by a light bulb)
2) Write data to PLC
3) Read data from PLC


1. Preparatory conditions

  • software:
    S71200PLC Software
    LabVIEW2020
    HslCommunicationDemo software
  • hardware:
    PLC Hardware

2. Steps

1. HslCommunicationDemo

Step1. Open the Siemens PLC project and check the IP address of the interface [here I have actual PLC hardware, connected to the laptop via an Ethernet cable, and set the IP to 192.168.0.1], and make the IP address in HslCommunicationDemo the same.
insert image description here
Step 2. Go back to PLC, go to the connection mechanism, and check Allow remote communication access.
insert image description here
Step 3. Go back to Demoz and click Connect. It will be OK when it prompts that the connection is successful.
insert image description here

Question 1: Connection failed?

insert image description here
Solution to the connection failure in the above figure:

  • Check if it is restricted by the firewall

Question 2: CPU hardware does not match the hardware on the Botu? [2 solutions

insert image description here

方法1

I went searching a lot about the incompatibility between the program version on the CPU and the STEP 7 project version V16.
This article inspired me:Solve the problem that higher versions such as Botu V15 V16 V17 V18 and lower versions are incompatible on the same PLCHe said博图V17依旧有一个小问题,他这个创建好了,但是固件版本依然是4.5版本的,所以我们需要重新更改一下,点击在线和诊断
I followed the steps, but I found that after I connected to my PLC online, the firmware version was V4.5, not 4.2. But I have V16, and the highest version is only 4.4. [As shown in the figure below:

Steps: First connect online, click Online and Diagnose
insert image description here
Finally, I only executed复位为出厂设置After reconnecting to the PLC and uploading from the device, all the way to green light.
insert image description here

方式2: Download the hardware package directly [not verified yet]

Hardware package download address
After entering, find your Botu PLC software version number and download the full version.
insert image description here

The V16 package obtained after downloading:
insert image description here

After decompression, there are various ISP files
insert image description here
Install in "Tools" -> "Installation Package" [as shown below]
insert image description here

1.LabVIEW

Step 1. Connect to PLC

Rear Panel:
1)Interconnection interface->.NET->Constructor node
insert image description here
2) In the constructor, select the HslCommunication.dll file. The HslCommunication configuration items will appear.
insert image description here
3) Specific options in configuration items

  • HslCommunication.Profinet.Siemens->SiemensS7Net->SimensS7Net构造器
    insert image description here

4) Final back panel configuration
insert image description here
After startup, the front panel effect is:
insert image description here

Step 2. Write data to PLC and read data from PLC

insert image description here

Front panel operation effect:
insert image description here


2. 1200PLC cannot upload from the device?

insert image description here

insert image description here

insert image description here

3. Use HslDemo test tool to control

Prerequisite: HslDemo tool has been connected to PLC
insert image description here

Step 1. Draw a simple diagram in Main in Botu PLC

The I0.1 and Q0.1 here are the names of the interfaces that come with the CPU board when you click Add New Device [regardless of whether they are physically connected or not]
insert image description here

In the single data write test of the HslDemo test tool, write Q0.2, and the value is 1. After clicking bool write, you can see that the PLC is connected in real time. [Proof of successful test]
insert image description here


4

insert image description here

Update time

2024-07-10
2024-07-11 Resolved hardware mismatch issue.
2024-07-12 Updated the hardware package download to solve the problem of hardware version number mismatch. [However, the verification process of re-establishing the project after the last step of installation was not done, and the credibility is unknown]