Pro
12 min
Lesson 10 — Counter (CTU)
curriculumlessoncounterCTU
Ready to build this?
Sign up free — no credit card required. This scenario requires the Pro plan.
Sign up to play this scenario →Already have an account? Log in
Briefing
CTU (Count Up) increments on each rising edge of CU. When the count reaches the preset value PV, the Q output goes true. A CNT_RESET input clears the count back to zero. Used everywhere for batch counting — parts on a conveyor, boxes on a pallet.
Objectives
- BIN_FULL goes true after 10 PART_SENSOR pulses
- CNT_RESET clears the count and turns off BIN_FULL
Hints
- Declare: CNT : CTU; Call it: CNT(CU := PART_SENSOR, R := CNT_RESET, PV := 10);
- CNT.Q goes true when CNT.CV >= 10.
I/O Table
Inputs
PART_SENSORPart-detection photo-eye
BOOL · %I0.0
CNT_RESETCounter reset input
BOOL · %I0.1
Outputs
BIN_FULLBin full indicator
BOOL · %Q0.0
Your program will be tested against:
All test cases run automatically when you submit. Assertions are hidden until you pass.
- #110 pulses → BIN_FULL on
10 rising edges on PART_SENSOR → BIN_FULL true
- #2CNT_RESET clears count and BIN_FULL
After BIN_FULL, pressing CNT_RESET clears everything
Related scenarios
Ready to build this?
Sign up free — no credit card required. This scenario requires the Pro plan.
Sign up to play this scenario →Already have an account? Log in