Lessons · Industrial control · counting events
Counting edges
A count-up counter (CTU) adds one each time its input goes from off to on. Holding the input on does not keep counting: it counts transitions, not 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
Parts on a conveyor, cycles on a press, bottles in a case: production is counted in events, and the counter is the event tally.
How to think about it
Feed the counter a clean signal that rises once per event. If a sensor chatters, condition it first. Give the counter a reset, and read its done bit when the preset is reached.
Worked example
[PartSensor] [/PartWas] (PartPulse)True for exactly one scan when the sensor first sees a part: the off-to-on edge a counter counts.
[PartSensor] (PartWas)Memory of last scan, written after it was read.
[PartPulse] (L Counted)Each pulse is one count; a CTU increments once per PartPulse, never while the part sits there.
Your turn
Count each pulse toward a case of twelve.
[PartPulse] [CTU Case ]
Run a rung and watch the scan
The trap
A counter fed a level instead of an edge counts once and stops, because the input never goes off. It looks like a broken counter; it is a missing edge.