Lessons · Industrial control · logic that is one scan behind
Logic that is one scan behind
Put the same two rungs the other way round and the answer still arrives -- one scan later, every time.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
A delay you cannot see in the listing. It gets blamed on the sensor, the drive, or the machine being 'a bit tired'.
How to think about it
Suspect it when a machine is right at low speed and wrong at high speed. Then watch it: a condition true on one scan with the output following on the next is a scan of delay, not a logic error.
Worked example
[Mid] (Out) [A] (Mid)A off, then on, then held. Out: 0 0 1 -- one scan behind the version with the rungs the other way round.
Your turn
How late is a rung that reads a bit written below it?
scan
Run a rung and watch the scan
The trap
Chain four rungs backwards on a machine indexing every 200 ms and the delay is a real fraction of the cycle.