← All exercises

Batch Counter

easy

Pulses BatchReady every 5 trigger events and tracks the running batch count.

What it teaches

Pulse a 'batch ready' signal every 5 items, and keep track of how many batches have completed. The 'ready' pulse should be one scan wide — a heartbeat, not a hold. A common pattern in packaging and dosing systems.

Inputs and outputs

TagTypeDefaultDescription
In_TriggerBOOLItem trigger event
Out_BatchReadyBOOLBatch ready signal
Sts_BatchCountDINTTotal completed batches

Required behavior