迪文科技论坛

 找回密码
 立即注册
搜索
查看: 11228|回复: 0

【Share】PLC Routine: DWIN panel and Siemens PLC hardware and software con...

[复制链接]

567

主题

167

回帖

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12046
发表于 2021-6-4 14:36:02 | 显示全部楼层 |阅读模式
This paper introduces the connection of software and hardware between DGUS Ⅱ touch panel and Siemens PLC through Modbus RTU protocol.
1.Effect display
DWIN product model: DMT10600T070_A5WTC
Siemens PLC: S7-200 Smart
Resolution: 1024*600

Effect display 1: VB hold area verification demonstration video
Effect display 2: external output verification demonstration video
Effect Display 3: External input validation demo video
The DGUS Ⅱ touch panel with the model of DMT10600T070_A5WTC was selected in the video. The product is a 7-inch high-resolution, industrial-grade intelligent HMI with rich interfaces, waterproof and UV proof, and can be used both indoors and outdoors. Outdoor use of anti-glare, high and low temperature shell deformation. The panel is capacitive touch panel, which can realize the functions of sliding page turning, gesture adjusting data, etc., with good touch effect and high sensitivity, bringing wonderful human-computer interaction experience.
PLC model is Siemens S7-200 SMART, this product adopts a new CPU module, which can fully meet the various needs of different industries, different customers and different equipment. SR/ST standard CPU can be extended by 6 extension modules and 1 signal board, which is suitable for the application with more I/O points and complex logic control. S7-200 Smart CPU modules are all integrated with an RS485 interface, which can communicate with third party devices such as frequency converter and touch panel. If additional serial ports are required, this can be achieved by extending the CM01 signal board, which supports RS232/RS485 free conversion. The serial port supports the Modbus RTU protocol.
2 .Connect guide detailed explain2.1 Hardware connect guide
As shown in the following figure, the touch panel communication interface uses RS485 of COM4, namely, pins A and B, and the power supply is 24VDC, namely, pins V and G.
PLC communication interface using communication port (X10), communication port for the standard DB9 female head, 3 feet for A, 8 feet for B, respectively and touch panel A-A,B-B docking, X11 L+ 24V+, M 24V-.
2.1.1 Interface define
When external input is read, use I0.0 input to connect X11 terminal 1M to 24V-, and then connect the 0.0 terminal to 24V+ after pressing the key. Press the key, I0.0 input 24V, and there is input, otherwise there is no input. The wiring diagram is as follows:
2.1.2 Hardware connect rendering

2.2 Software Configuration Guide2.2.1 Siemens STEP 7-Microwin Smart programming software configuration
(1) New project and save:
(2) The project interface is as follows. Double-click the PLC hardware configuration to select the communication setting port:
file:///C:\Users\Aaron\AppData\Local\Temp\ksohtml4696\wps7.jpgfile:///C:\Users\Aaron\AppData\Local\Temp\ksohtml4696\wps8 .jpg
(3) The communication parameters of Siemens are set through the program. The configuration is as follows:

a. Power on and run once:
Each code is as follows:
Mode
Mode select: start/stop Modbus, 1= start; 0 = stop.
Address
Slave address: Modbus slave address, value 1~247.
Baud
Baud rate: available 1200,2400,4800,9600,19200,38400,57600,115200.
Parity
Parity check: 0= No check; 1= odd check; 2 = parity checking.
Port
0=CPU integrated RS485 communication Port 0, 1= optional signal board communication Port 1.
Delay
Delay.:delay between additional characters. Default is 0.
Max IQ
The S7-200 Smart's I/O image area is 256/256. The default value is 256.
Max AI
The maximum number of AI words, the maximum number of AI channels involved in communication, ranges from 0 to 56. A value of 0 disables reading analog input.
Max Hold
Maximum hold register area, V storage word (VW) involved in communication.
Hold Start
Keep register area starting address specified as &vbx (indirect addressing mode).
Done
Initialization completed flag, after successful initialization set 1.
Error
Initialize the error code.
Note: In this example, set the slave address to 3 and the Port0 communication baud rate to 9600 without checking; The maximum number of input and output points of the S7-200 Smart can be used is 256; The maximum analog input register of the S7-200 Smart that can be used is 56 words; The V block register address that can be used is 1000 words, starting with VB1000 address. Note: In this example, the library used by the Modbus RTU slave instructions is stored as VB0-- VB780. This register address can no longer be used by any instructions in the program, including the MBUS_INIT and MBUS_SLAVE instructions.

b. Implement the Modbus communication protocol:
c. Allocate the Library instruction data area in the CPU's V data area(Library Memory):
At this point, communication port configuration is complete.
2.2.2 Write PLC verification program
Please read the following content carefully before writing PLC program:
(1) PLC address corresponding table:
(2) PLC reading and writing function code:
Above, we only read and write the contents of Q/I/ area, using function code 01/02/03/06/15(0F).
(3) Precautions
Note: The Hold register area specified by the subroutine parameters HOLD START and MAX HOLD is allocated in the V data store of the S7-200 SMART CPU. This data area must not have any overlap with the library instruction data area. Otherwise, an error will occur at runtime and communication will not be normal. Note that the Hold register area in Modbus is addressed "word", i.e., Max Hold specifies the number of VW, not VB.
When PLC Modbus initializes, it is stipulated that the Modbus keep the register area starting from VB1000 (Hold Start = VB1000) and keep the register at 1000 words (Max Hold = 1000), because the keep register is in word (two bytes). In fact, this communication buffer occupies a total of 2000 bytes of VB1000 ~ VB2999. Therefore, the allocation library instruction should at least avoid the VB1000 ~ VB2999 interval when reserving the data area.
Also, pay particular attention to the size of the CPU's V storage area selected. The size of the data storage area varies with the CPU model. Modbus should be selected as needed to preserve the size of the register area.
Since VW is in word units and the starting address is VB1000, the corresponding address is as follows:
VW1000-> 40001
VW1002-> 40002
VW1004-> 40003
...
VW1010-> 40005
...
VW1020-> 40010

2.2.2.1 Read and write of external output coil (Q0.3)
This example does not need PLC to write the program.
2.2.2.2 Read and write of external input coil (I0.0)
This example does not need PLC to write the program.
2.2.2.3 Real-time reading and writing of variables
This program reads two variables in total. The attribute of variable 1 on the touch panel is "read and write", corresponding to PLC address VB1010. When variable 1=100, Q0.0 is on, and other values Q.0 are off. When the variable is greater than 10, the count starts from zero, and the cycle repeats when the variable is greater than 5, Q0. When the light is less than 5, it is extinguished. PLC procedure is as follows:
PLC program link: see the compressed file "Siemens PLC Engineering -- PLC Program".
2.2.3 Software configuration of touch panel
1. Touch panel engineering documents:
See the compressed file "Siemens PLC Engineering" - DGUS Ⅱ Touch panel Program "for details.
2. Touch panel OS program:
(1) The main functions of touch panel OS program are to read and write "output coil Q0.3", read "output coil state (I0.0)", read and write "VB keep register" state.
(2) OS program link: see the compressed file "Siemens PLC Engineering" - OS_SIEMENS "for details.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|迪文科技论坛 ( 京ICP备05033781号-1 )

GMT+8, 2024-12-4 16:42 , Processed in 0.076421 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表