Pro
12 min

Lesson 10 — Counter (CTU)

curriculumlessoncounterCTU
Lesson 10 — Counter (CTU) scenario preview

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_SENSOR

Part-detection photo-eye

BOOL · %I0.0

CNT_RESET

Counter reset input

BOOL · %I0.1

Outputs

BIN_FULL

Bin 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.

  1. #110 pulses → BIN_FULL on

    10 rising edges on PART_SENSOR → BIN_FULL true

  2. #2CNT_RESET clears count and BIN_FULL

    After BIN_FULL, pressing CNT_RESET clears everything

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