Hone

Lessons · Industrial control · a latch remembers, a coil does not

A latch remembers, a coil does not

An ordinary coil is rewritten every scan and cannot remember anything. A latch writes once and waits to be unlatched.

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 difference between 'is this true now' and 'did this happen', and picking the wrong one is a whole class of fault.

How to think about it

If the answer to 'should this be on?' is a live question with a live answer, use a coil. Latches are for things that must outlive the thing that caused them.

Worked example

[A] (Lamp)
A on, then off. Lamp: 1 0
[A] (L Lamp)
The same input. Lamp: 1 1

Your turn

Which one survives its own condition going false?

the 

The trap

A latched bit you are looking at was set at some earlier moment you did not see. That is why latched faults usually carry a timestamp.

Practise a latch remembers, a coil does not on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.