Hone

Lessons · Industrial control · latch, seal-in, or plain coil

Latch, seal-in, or plain coil

A seal-in is a rung that stays true. A latch is a bit that stays set. The difference is where the release lives.

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 seal-in keeps its stop in the rung, in series, in sight. A latch puts the release somewhere else in the program, where it can be missed.

How to think about it

For anything with a stop, prefer the seal-in: what stops it is written next to what starts it. Reach for a latch when the state genuinely has to outlive the rung.

Worked example

{ [Start] | [Motor] } [/Stop] (Motor)
The seal-in. Start on scan 2, Stop held on scan 3, Start pressed again on scan 4. Motor: 0 1 0 0 -- the stop is right there in the rung.

Your turn

Which pattern keeps the stop condition inside the rung?

the 

The trap

Many shops require the unlatch on the very next rung. It is a convention, not a rule of the language, and it exists because the pair is one idea.

Practise latch, seal-in, or plain coil on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.