Hone

Lessons · Industrial control · rung 2 sees what rung 1 wrote

Rung 2 sees what rung 1 wrote

Rungs are solved in order, and each one uses the values as they stand at that moment -- including anything an earlier rung has just written.

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

It is the single fact that makes ladder read differently from every text language, and it is what lets a whole chain resolve in one scan.

How to think about it

Write the program in the order the machine works, top to bottom. Then a bit made on one rung is available to every rung below it, in the same pass.

Worked example

[A] (Mid)
[Mid] (Out)
A off, then on. Out: 0 1 -- Out came on in the SAME scan A did.

Your turn

A rung can use a bit written by an earlier rung in the same scan.

the earlier rung must be  it

The trap

This only works downwards. A rung that reads a bit written below it is reading last scan's value.

Practise rung 2 sees what rung 1 wrote on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.