当前位置:网站首页>Technical puzzle | how does PLC execute interrupt? How to apply it?
Technical puzzle | how does PLC execute interrupt? How to apply it?
2022-04-22 08:03:00 【weixin_ forty-five million four hundred and eleven thousand sev】
PART1
How to understand PLC Interrupt function of ?
When understanding interruptions , First of all, be clear PLC The operation cycle or scanning cycle , It's necessary to say PLC The process of sequential control cycle execution , This is the premise of understanding interruption , Must master , Divided into three parts : Input processing 、 process 、 Output processing .

1、 Input processing
The programmable controller before executing the program , Connect all input terminals of the programmable controller ON/OFF The status is read into the input image area , Even if the input changes during program execution , The contents of the input image area will not change , The change is read when the input processing of the next cycle is performed .
2、 process
PLC According to the instructions in the program memory , The image of each soft element is read out from the input image area and the image area of other soft elements ON/OFF state , And then from 0 Start the operation step by step , And write the results obtained each time into the image area . therefore , The image area of each soft component changes its content gradually with the execution of the program , Besides , The internal contact of the output relay performs action according to the content of the output image area .
3、 Output processing
After all instructions are executed , Output Y In the image area ,ON/OFF The status is transferred to the output latch memory , This is the actual output of the programmable controller .
The time required to perform an action is the operation cycle, also known as the scanning time , So what is the relationship between the interrupt and the scan cycle , An interrupt is a complete execution that does not follow the order from top to bottom , Instead, the interrupt program gives priority to running the program processing alone, and it is output immediately, and does not participate in the operation of the whole cycle .
PART2
What is the function of interruption ?
We know PLC The scanning period is very short , So it's hard to see PLC Sequence control execution process , Here we might as well assume that the scanning period is 10s Time for , Is the need to execute all the procedures 10s Time for , There is a very simple program LD X0,OUT Y0, According to the above picture X0 by ON when ,Y0 There is no immediate output , But wait until 10s Output after , To break off X0 after , Again Y0 It's not closed right away , All need to be scanned before there are results . So in our practical application PLC There is nothing to use, and the equipment can't work , At this time, you need to interrupt processing , Adopt input interrupt function , Execute the input immediately . actually PLC The operation time is very short, only a few milliseconds , Can meet the needs completely , But some, such as high-frequency pulse input 、 The time of pulse capture at the microsecond level must be affected by periodic operation .
So if you have to do it many times in a cycle ON/OFF State processing , The interrupt function must be used . In general, we rarely use interrupts , Even if needed PLC All high-speed instructions have interrupt function, so you don't need to write interrupt subroutine , For example, the high-speed counter processes the high-speed pulse from the specific input relay in the way of interruption , Therefore, no matter how long the operation time is, it can be counted , The result of counting or using the special comparison instruction of high-speed counter is output immediately , Or the count value of the high-speed counter is interrupted by the high-speed counter to execute specific program processing .
High frequency pulses are counted without using a high-speed counter , For example, we use the interrupt function to count the high-speed input , Examples are as follows , from EI To FEND Is the main program , From the pointer I101( Input X0 Interrupt pointer for ) Start to IRET It's an interrupt subroutine , Whenever you feel X1 The rising edge of executes a subroutine to immediately transfer the value to D10 in , This avoids PLC The influence of operation cycle .

In this paper, the source :PLC enthusiasts
( Network text , The copyright belongs to the original author , Invasion and deletion )
版权声明
本文为[weixin_ forty-five million four hundred and eleven thousand sev]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220626278641.html
边栏推荐
猜你喜欢

Raspberry Pie: simulating iSCSI storage

Call another function within a shell function (without return value and with return value)

基於卷積神經網絡LeNet-5模型的mnist手寫數字識別

Charles使用之修改请求和响应的三种方式

实验5 组件及事件处理

SuperSocket在.Net5中使用——WebSocket Server篇

Raspberry pie 4B: USB mobile hard disk box startup (beta version)

XSS靶场过关

Read iso15031 protocol data stream

China network security industry panorama of ccsip 2021 listed by Shiping information
随机推荐
Winform让Form窗体切换前置及活动状态
Industry application | the way of data security and compliance construction of government big data platform
mysql中查询遇到longtext类型,查询效率很低。
2021-10-08 Selenium无头模式打开浏览器
Autoware Demo测试
.net core CefSharp ChromiumWebBrowser中网站JS调用winfrom程序中C#方法
A simple image processor running across C raspberry pie
世平信息上榜《2021年中国网络安全市场全景图》
Resolve SSL SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
数据库原理课程设计——物资发放管理系统
The difference between synchronized and reentrantlock
A simple implementation of esp32 graphic web server
How to protect personal information security@ Everyone must not miss this dry goods sharing
杭州市商用密码应用协会领导一行莅临世平信息参观交流
OBD外接测试设备初始化判断协议类型(SAE J1939/ISO15765/ISO27145)
行业应用 | 政务大数据平台数据安全合规建设之道
SSRF 与 XXE 攻击原理及利用
文件安全笔记
MySql查询指定一行排序到第一行
XSS range clearance