Clearly, the logic is correct, but when the button is pressed, the device hesitates for a moment as if contemplating life before acting? The same input signal is used twice in the program, yet the results can be strangely different?
Many beginners frantically check the program, unaware that the root of the problem may lie far beyond the code—hidden in the core mechanism of the PLC that you have never directly observed.
Today, we will not discuss complex instructions but will unravel a core mystery. Understanding it will allow you to explain all the aforementioned supernatural phenomena and fundamentally grasp the behavioral logic of the PLC.

Core Mechanism: An Unfaltering “Three-Stage Invisible Pipeline”
Forget the “event-driven” computer thinking. In your mind, construct an ever-moving, orderly industrial pipeline divided into three stations.
The life of a PLC is composed of this pipeline looping over and over again. It is called the “scan cycle”.
Station One: Global Scanning (Input Sampling) — Snapshot Moment
At the start of each cycle, the PLC performs a crucial action: it surveys all input points (I0.0, I0.1…) at microsecond speed, capturing their on/off states (0/1) all at once, like pressing a shutter, and stores them in a temporary area called the “input image area.”
[Key Insight] Throughout the current cycle, regardless of how external buttons shake or sensor signals fluctuate, this “input snapshot” remains frozen and unchanged.
Why? To ensure a consistent basis for logical judgment. Imagine trying to solve a problem where the numbers keep changing; you would never arrive at a result.
Station Two: Decision-Making in a Secluded Room (Program Execution) — Sandbox Simulation
Now, the CPU becomes the supreme commander. It takes the “input snapshot” from the previous station and enters the “war room” (user program), starting a secluded sandbox simulation from the first line of instructions.
It scans your ladder diagram line by line: “If I0.0=1 and I0.2=0, then set M0.0=1…” “If T37 time is up, then set Q0.0…”
Note! All calculation results at this stage only update the states of internal soft components (M, T, C, output image area). This is entirely an internal exercise, and will not immediately affect the physical state of any actual output points.
Station Three: Thunder Execution (Output Refresh) — Unified Command
Once the last line of the program has been simulated and the decision has been made, the PLC will copy the final results from the “output image area” all at once and synchronously to the physical output module.
Thus, Q0.0 engages, the contactor operates; Q0.1 disconnects, and the indicator light goes out. At this moment, the external world truly perceives the will of the PLC.
With the execution completed, a scan cycle ends. The PLC does not pause, immediately starting the next loop and re-entering “Station One.”
The Three Soul Questions: Why Design It So “Complicated”?
You might wonder: wouldn’t it be more direct to have “input changes, output changes”? No, this “cyclic scanning” mechanism is precisely the cornerstone of the PLC’s rock-solid stability in harsh industrial environments.
- [Interference Resistance Artifact] Effectively filters out jitter and spikes in input signals. Since sampling only occurs at “Station One,” subsequent interference signals are completely ignored within the current cycle, greatly enhancing system stability.
- [Logic Guardian] Prevents inconsistent logical criteria caused by changes in input signals during program execution, fundamentally avoiding contradictory and chaotic outputs.
- [King of Determinism] Regardless of how complex the program is, the response delay of I/O to inputs does not exceed one scan cycle. This predictable timing is crucial for precise control.
Cognitive Leap: From “Supernatural Phenomena” to “Clear Understanding”
Now, let’s use this mechanism to revisit and decode the “supernatural phenomena” presented at the beginning of the article:
-
[Phenomenon One] Device Response is “Half a Beat Slow”
- Truth: When you press the button, you may have just missed the “input sampling” station of the current cycle. The signal must wait until the next cycle to be sampled, then go through “program execution,” and finally act during “output refresh.” This 1-2 cycle delay is what you perceive as “half a beat slow.”
-
[Phenomenon Two] The Same Signal, Different Results
- Truth (almost impossible): Under the centralized sampling mechanism, the state of I0.0 seen throughout the program within one scan cycle is completely consistent. This phenomenon is more likely due to program logic errors or physical wiring issues, rather than an unconventional scanning mechanism. This indicates that understanding the principles allows you to more accurately pinpoint the real problem.
-
[Core Instruction Revelation] Why Trigger on “Rising Edge/Falling Edge”?
- Ultimate Answer: Precisely because the PLC only sees one “input snapshot” in each cycle. If a certain input signal remains in the “1” state for two consecutive cycles, the PLC cannot perceive its transition moment from 0 to 1. The “rising edge” instruction acts as a cross-cycle comparator, capturing the changing “edge” by comparing the current snapshot with the previous snapshot, thus executing a one-time action. This perfectly compensates for the shortcomings of the scanning mechanism.
Conclusion: Your First “Dimensionality Reduction Strike”
At this moment, the PLC is no longer mysterious in your eyes. It is a regularly operating invisible pipeline. The program you write is the law it must follow at the “decision-making” station.
Understanding the scan cycle is your first “dimensionality reduction strike” against the PLC. In the future, no matter how complex the program is, you will be able to penetrate the code, reaching the core, and clearly anticipate its every breath and heartbeat.
This is your solid first step from being a “code mover” to a “system architect.”
Follow the WeChat public account「Instrumentation Notes」 for more exciting content.
Previous Highlights:
PLC is not a black box! Understand these three steps, and you can tame it.
The secret battlefield of instrumentation engineers: You know the technology, but why do the accolades always go to others?
PLC experts are using these! If you don’t understand these 8 types of sensors, don’t say you understand automation!