← All exercises

Count Up Down

easy

Bidirectional counter with separate Up and Down inputs that tracks a running balance.

What it teaches

A counter that goes both ways — up and down. Useful for tracking running balances like 'how many parts are currently in the bin'.

Inputs and outputs

TagTypeDefaultDescription
In_UpBOOL
In_DownBOOL
Sts_CountDINTCurrent accumulated count

Required behavior

  • Sts_Count increases by 1 on each rising edge of In_Up.
  • Sts_Count decreases by 1 on each rising edge of In_Down.