How to continuously monitor external signals?

Time:2021-5-10

I do PLC development, mainly control hardware. For example, the x-axis motor moves forward and stops when it meets the sensor SB1. The SB1 must be in a continuous monitoring state, and the program cannot read the SB1 state in a periodic manner. Otherwise, when the last behavior of reading SB1 ends and the next behavior of reading SB1 does not arrive, SB1 is triggered, but the program does not know, then the x-axis motor will rush past, causing damage to the machine.
PLC itself can continuously monitor the sensor without additional programming. Users only need to associate SB1 with X-axis motor; When SB1 is triggered, the x-axis motor will stop.
The C # upper computer actually monitors a bit in the PLC, such as m100.0. M100.0 is associated with SB1. When SB1 changes from 1 to 0, m100.0 will also change from 1 to 0; On the contrary, if SB1 changes from 0 to 1, m100.0 will also change from 0 to 1.
Therefore, C # only needs to monitor m100.0 in PLC. This monitoring is continuous. As long as there is a change in m100.0, C # can know and respond.
Excuse me, how to do this kind of continuous surveillance?
PS: I’ve thought about using while (true), but I don’t think it’s good [url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]
[url]https://book.douban.com/douli…[/url]
[url]https://movie.douban.com/doul…[/url]
[url]https://www.douban.com/doulis…[/url]
[url]https://m.douban.com/doulist/…[/url]