← Counters

Magazine Counter

medium

Tracks parts in a feeder magazine: reload fills the count, then each dispense edge counts down to zero.

What it teaches

The mirror of Count Up: a feeder magazine holds a fixed number of parts, such as screws or labels. Reload fills the count, then each dispense edge counts one part down. The floor is the lesson — a plain subtraction happily goes negative, so you clamp at zero and report empty instead.

Parameters

TagDirectionTypeDefaultDescription
In_DispenseInputBOOL0Part dispensed; one count per rising edge
In_ReloadInputBOOL0Reload button; rising edge loads a full magazine
Cfg_MagazineSizeInputDINT5Parts in a full magazine
Val_RemainingOutputDINT0Parts left in the magazine
Sts_EmptyOutputBOOL01 while the magazine is empty

Required behavior