Free
15 min

Beginner 11 — Count five boxes and stop (CTU)

beginnerfundamentalscountersctuconveyor

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in

Not ready to sign up? Run a live lab now — no signup →

Beginner 11 — Count five boxes and stop (CTU) scenario preview

Briefing

The last lesson counted five boxes and lit CARTON_FULL. Now put that counter on a real conveyor. Tap START and the MOTOR runs. Each box that trips BOX_EYE adds one to the count. After five boxes the carton is full: the CARTON_FULL lamp is on and MOTOR must stop. Tap CNT_RESET to clear the count and lamp so the next carton can begin. The starter already holds the BOX_CNT counter call and the CARTON_FULL lamp rung from the last lesson, and START already latches MOTOR on. Your one new job is the stop: use the counter's Q (done) output to switch MOTOR off when the carton is full.

Objectives

  • Tap START → MOTOR runs, CARTON_FULL off
  • Five BOX_EYE pulses → MOTOR stops and CARTON_FULL turns on
  • Tap CNT_RESET → count clears, CARTON_FULL off, conveyor can restart

Hints

  • The counter and the CARTON_FULL lamp are already in the starter. The new part is the stop: switch MOTOR off when the carton is full.
  • BOX_CNT.Q (the counter's done output) turns on at the fifth box. Add a rung with a BOX_CNT.Q contact driving a Reset (R) coil on MOTOR.
  • START is momentary, so MOTOR must hold on after START is released (the starter uses a Set coil). Keep that, and keep the stop rung on the plain (not slashed) BOX_CNT.Q contact.
  • Equivalent logic is accepted: an NC /BOX_CNT.Q contact in a normal MOTOR seal-in rung is as valid as resetting a SET coil when BOX_CNT.Q turns on.

I/O Table

Inputs

START

Momentary start push-button (NO)

BOOL · %I0.0

CNT_RESET

Counter reset push-button (NO)

BOOL · %I0.1

BOX_EYE

Photo-eye — pulses once per box

BOOL · %I0.2

Outputs

MOTOR

Conveyor motor contactor

BOOL · %Q0.0

CARTON_FULL

Carton-full indicator lamp

BOOL · %Q0.1

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Tap START → MOTOR on, CARTON_FULL off

    A momentary START latches MOTOR on before any boxes are counted

  2. #2Five BOX_EYE pulses → CARTON_FULL on, MOTOR off

    Five rising edges on BOX_EYE triggers CTU.Q which stops motor and lights lamp

  3. #3Three BOX_EYE pulses → MOTOR still on, CARTON_FULL off

    Fewer than five pulses: counter has not reached PV so conveyor keeps running

  4. #4CNT_RESET after full carton → lamp off, conveyor can restart

    After CARTON_FULL, CNT_RESET clears the counter so START latches the motor again

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in

Not ready to sign up? Run a live lab now — no signup →

Runnable simulator field guide

Beginner PLC counter scenario: test checklist

Direct answer

The learner can predict every count, prevent repeated counts from a held sensor and test completion and reset from known initial values.

Written for pLC beginners counting simulated parts and learning the difference between sensor state, edge event, accumulator and batch completion.

a PLC scan-cycle bench used to correlate physical inputs, program state, timer or counter execution, output indication and repeated timing evidence while studying part-count events, preset, done state and reset behavior
System map / 02

NODE 01observable

Scenario setup

Counted object, sensor active state, pulse duration, scan assumption, edge event, counter instance, accumulator, preset, done use, reset, initial state and data limit.

NODE 02observable

I/O and state map

Part movement through sensor and sampled input to edge detection, accumulator change, done state, downstream action and displayed batch count.

NODE 03observable

Normal run

Each representative part adds exactly one count and the declared preset produces one intended completion result.

NODE 04observable

Boundary run

Held sensor, bounce, two close parts, missed short pulse, simultaneous count and reset, zero preset, maximum count, reset and power return.

NODE 05observable

Injected fault

A material, sensor, input, pulse, scan, edge, instance, accumulator, preset, reset or output mismatch.

NODE 06observable

Target check

The behavior recreated using target input hardware and exact counter instruction semantics.

Answer surface / 07

How do you count products with a PLC?

Detect one reliable event per product, feed it into a dedicated counter instance and verify accumulator, preset, reset and downstream use.

Why does a counter add more than one count for one product?

The sensor may chatter or remain true while the program applies level logic repeatedly; use documented edge behavior and test the physical pulse.