Fix 04 — Counter won’t reset
Ready to build this?
Sign up free — no credit card required. This scenario requires the Basic plan.
Sign up to play this scenario →Already have an account? Log in
Not ready for Basic? Try a free scenario like this →
Briefing
A packing station counts boxes with an eye. When three boxes have passed, BATCH_FULL lights so the operator can swap the crate. Pressing RESET_PB should clear the count for the next batch. The count and the lamp work, but RESET_PB does nothing, so the lamp stays on for ever. Find out why, and fix it.
Objectives
- The lamp stays off for the first two boxes
- The third box lights BATCH_FULL
- RESET_PB clears the lamp
- The next batch needs three fresh boxes, even after a reset in the middle of a batch
Hints
- Fill a batch, press RESET_PB, and watch BATCH_FULL. Then look in the program for anything that reads RESET_PB.
- A counter keeps its value until it is told to clear. Find where this counter is told, and what it is told today.
- Clearing only the lamp is not enough: the count itself must go back to zero, or the next batch would be full after fewer boxes.
- Test a reset in the middle of a batch as well as after a full one. After any reset, three more boxes must be needed.
I/O Table
Inputs
BOX_EYEBox counting eye (TRUE while a box is in the beam)
BOOL · %I0.0
RESET_PBBatch reset push-button (TRUE = pressed)
BOOL · %I0.1
Outputs
BATCH_FULLBatch full lamp
BOOL · %Q0.0
Your program will be tested against:
All test cases run automatically when you submit. Assertions are hidden until you pass.
- #1Two boxes → lamp off
The batch is three boxes, so two boxes do not fill it
- #2Three boxes → lamp on
The third box fills the batch
- #3RESET after a full batch → lamp off
Pressing RESET clears the full lamp
- #4After a reset, three fresh boxes are needed
The count restarts at zero: two boxes leave the lamp off, the third lights it
- #5RESET in the middle of a batch → count restarts
A reset after two boxes throws that count away
- #6A fourth box → lamp stays on
A full batch stays full until RESET
Related scenarios
Ready to build this?
Sign up free — no credit card required. This scenario requires the Basic plan.
Sign up to play this scenario →Already have an account? Log in
Not ready for Basic? Try a free scenario like this →