Loading local progress…
Practice missions
Practise in
Level 1, 0 XP · your progress
Mission 10 · Free PLC counter exercise

Count the arrivals

Count each bottle once. Stop at three.

Run the conveyor (ConveyorOn) until the BottlePresent has seen three bottles. Then turn Done ON and ConveyorOn OFF. Pressing Reset clears the count and Done, so the conveyor runs again.

Free, with no sign-up. Create a free account to keep your progress on every computer.

The 3D filling line this mission runs on
Test replay

Held sensor is one bottle

Test 1 of 3
Set by the testChecked by the testStep 2 of 2 · 420 ms
Level
Foundation
Time
About 8 min
Reward
+100 XP
Rig
3D filling line
Siemens editors
SCL, LAD
Rockwell editors
Structured Text, Ladder
Course stage
5. Count an event once
Automatic tests

What the tests check

  1. A bottle that sits in front of the sensor counts as one.
  2. The third bottle turns Done ON and stops the conveyor.
  3. Reset turns Done OFF and sets the count back to zero.
  1. Try it Use the buttons below the model and watch the rig respond.
  2. Test solution Every check runs on your code in one press.
  3. Replay If one fails, step through it one scan at a time to see why.
Why it matters

Where you’d see this on site

On a drinks line, one bottle can sit in front of the counting sensor for a while. It still counts as one bottle.

Counting every scan can turn one bottle into hundreds. The line could report a full batch while most bottles are missing.

Where you'd find thisPutting drinks into bottles

At a soft-drinks factory, empty bottles arrive on a moving belt. A sensor tells the controller when a bottle is under the filling nozzle. The valve opens, fills the bottle, then closes before the belt moves again. Caps and labels go on before the bottles are packed.

  1. Empty bottlesThe belt brings them to the nozzle
  2. Fill each bottleStop it, fill it, then let it moveYou are here
  3. Add caps and labelsSeal the drink and name the product
  4. Pack the bottlesPut finished bottles into boxes
On a real site: places, parts and safety
  • Soft-drinks factory — filling bottles without spills
  • Dairy — putting milk into bottles
  • Cleaning-products factory — measuring liquid into containers
  • Food packaging line — counting bottles before packing

If the filling valve opens without a bottle under it, liquid spills onto the belt. If the line jams, the valve must not keep filling.

Real conveyors need guards. The power must be safely locked off before anyone clears a blockage. The Stop input here is not an emergency stop.

The sizes, timings and cutaways are teaching choices, not a drawing of any one real installation.

Keep going

Next in the course