Rung order matters

Rungs run from the top down. Rung 0 reads Motor before rung 1 writes it.

Step by step

Pick a step. The rungs are drawn by the editor after Core scans the program up to that step.

1. Press StartPB. Rung 0 runs first and reads Motor as 0. Then rung 1 turns Motor on. RunLamp is still off.

StepStartPBMotorRunLamp
1. Press StartPB110
2. Scan 2111
3. Release StartPB001
4. Scan 4000

Why it works

  • In one scan the rungs run in order. Rung 0 reads Motor as it was left by the last scan.
  • Rung 1 then writes Motor. Rung 0 sees the new value on the next scan.
  • One scan is a few milliseconds on a real machine, but the delay matters for one-shots and for sequences that check a value right after writing it.

Common mistakes

  • Expecting the change in the same scanPut the rung that writes a tag above the rungs that read it, when they must agree in the same scan.

Instructions used

Related