Unsynchronized actions have two possible origins: an inevitable order caused by program execution sequence, and the overall lag and jitter caused by a scan cycle that is too long. Telling them apart takes measurement, not guesswork from the symptom. This article gives the distinguishing features, the verification method and the order of treatment.
Sequence in the design is normal: within one scan the program runs from top to bottom, so an instruction written earlier changes state before one written later, which waits for the next scan. That kind of offset is fixed and predictable — the interval equals the scan time or the execution time of the program section. A fault-driven offset varies: the interval is large at times and small at others, does not match the measurements, or lags a beat behind the pushbutton.
Four typical signs: the action lags a beat behind the button and the amount of lag changes with program load; two outputs that should act together show a fixed time difference of one or several scans; high-speed actions drop beats or jitter; communication and scanning slow each other, so actions lag more when traffic is heavy. The common thread is lag and jitter, not an action that never happens at all.
Three checks. First, monitor the current scan time, the maximum scan time and the execution time of each program section online, and see whether the maximum is approaching or exceeding the lag the machine allows. Second, capture the input signal and two output rising edges together on an oscilloscope or logic analyser, measure the real interval and compare it with the scan time. Third, disable or split the subprograms one by one and watch which section changes the interval, which locates the code that stretches the scan. The three sets of evidence corroborate each other; judging from the symptom without measuring usually blames the wrong thing.
Besides the scan cycle, several other things produce a similar picture: filter times set differently between input channels, so the signals themselves arrive in a different order; mechanical operating times that differ with output type, a relay being slower than a transistor; the real response of pneumatic and hydraulic valves and cylinders; the synchronisation period between a master and a slave PLC; the bus refresh period of remote I/O. Compare like channels and like loads rather than drawing a conclusion from one channel.
Measure before changing. Once the scan is confirmed as the cause, simplify the program and shorten the execution part and move non-real-time work into interrupts or spread it over several scans; for outputs that must stay in step, use the same module, the same refresh batch or high-speed outputs; and for safety-related actions do not rely on program synchronisation but wire them directly. After the change, re-measure the maximum scan time and the actual action interval and confirm the margin before returning to production.
| Symptom | Likely cause | How to verify | Direction of fix |
|---|---|---|---|
| Action lags as a whole behind the button | Scan time near or above the lag allowed | Read the maximum scan time online | Shorten the execution part |
| Fixed difference between two outputs | Program sections are ordered | Compare program execution order | Reposition or synchronise the outputs |
| Interval varies at random | Program branches or communication load fluctuate | Collect a scan time distribution | Cut communication load, stage the tasks |
| High-speed action drops beats | Action rate near or above the scan rhythm | Measure output frequency on a scope | Move to interrupt or a high-speed module |
| Inputs themselves arrive in order | Filter times differ between channels | Check each channel's filter setting | Make the filter times uniform |
| Same-class actions still differ | Mechanical time differs with output type | Compare relay and transistor outputs | Use one output type |
| Actuator responds slowly | Valve and cylinder response is slow | Measure at the actuator itself | Change the air circuit or re-select |
| Master and slave out of step | Master–slave communication period is long | Read the synchronisation parameters | Shorten the synchronisation period |
| Distributed stations lag | Remote I/O refresh period is long | Check the bus refresh time | Move closer or shorten the network |
In many cases the scan cycle is not the culprit at all: the program fakes synchronisation with time delays, estimating a wait with a timer, which drifts as soon as the load changes. A steadier approach is to confirm arrival with a status word or a handshake signal rather than depending on time. The judgement always rests on measurement: the same symptom has completely different fixes depending on whether the scan is overrunning or a delay is faking synchronisation.
The requirements for operational monitoring and response time of programmable controllers are given in GB/T 15969.2 and IEC 61131-2. Protection, earthing and fault diagnosis for electrical equipment of machines follow GB 5226.1 and IEC 60204-1, and graphical symbols and terminal designations for electrical diagrams follow the GB/T 4728 series. Module filter times, output delays and bus refresh periods are as stated in the manufacturer's technical data.
Any change to action timing must be made with the supply isolated, tested dead and locked off, and re-checked with measured data afterwards. Synchronisation of safety-related actions must not depend on the PLC program.