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.

Inputs and outputs

TagTypeDefaultDescription
In_DispenseBOOLPart dispensed; one count per rising edge
In_ReloadBOOLReload button; rising edge loads a full magazine
Cfg_MagazineSizeDINT5Parts in a full magazine
Val_RemainingDINTParts left in the magazine
Sts_EmptyBOOL1 while the magazine is empty

Required behavior