Loading local progress…
PLC Gym
PLC Gym homeLevel 1, 0 XP · your progress
Mission 57 · PRO (needs Pro)

Hold a job, then resume it: state machine PLC exercise

Add a Held state to the mixing job, and decide which request wins.

Add Hold, Resume and Stop to the mixing job. State is still one whole number (a ) in one CASE statement, with two new states: 30 Held and 90 Stopped. Hold pauses the job with every OFF. Resume carries on, but only once Hold is released. Stop wins over everything, and then only Reset lets the job start again. Change State at most once per .

This mission is part of ProCreate a free account: every account gets a free Pro trial until 5 December.

No card. Nothing to pay. Nothing to cancel.

Official release: 5 December. Top the leaderboard on the day and win 3 months of Pro, plus 2 weeks of Pro to give a friend. 2nd place wins 4 weeks. 3rd place wins 2 weeks. Rules

  • Every Coaching lesson, from zero
  • Every mission and lesson, as you level up
  • A practical test for every title, with a certificate
  • Rewind any test, one scan at a time
  • Worked solutions when you're stuck
  • The code converter, as much as you like
The 3D process tank this mission runs onPRO (needs Pro) mission
How the test runs

Start, complete and reset

Test 1 of 8
Set by the testChecked by the testStep 9 of 9 · 460 ms
Level
Advanced
Time
About 18 min
Reward
+400 XP
Rig
3D process tank
Siemens editors
SCL
Rockwell editors
Structured Text
Beckhoff editors
Structured Text
Stage
16. Write phases in text
Required behaviour

Hold a job, then resume it: what your code must do

This is the second of three missions on the same mixing job. The operating rules below list each state and what every output must be. When two requests arrive in the same scan, the order of your IF and ELSIF lines decides which one wins: Stop first, then Hold, then finishing.

0 · Idle
All outputs OFF. Start → 10, but only if Stop and Hold are released. Other inputs do nothing.
10 · Running
PumpOn, ValveCmd and MixerOn ON. Done OFF. Stop → 90. If not, Hold → 30. If not, MixDone → 50.
30 · Held
All outputs OFF. Stop → 90. If not, Resume AND NOT Hold → 10. Start, MixDone and Reset cannot restart it.
50 · Complete / 90 · Stopped
Pump, valve and mixer OFF. Done is ON only in 50. Reset → 0, but only with Stop released. It must not also start in that same scan.
Scan and reset rules
State starts at 0. Change State at most once per scan. On the scan where State changes, the outputs may match the old state or the new one, as a full set. From the next scan, they must match the current state. Reset does nothing in Running or Held.
Tag table

Hold a job, then resume it: inputs and outputs

Your program reads 6 inputs and sets 4 outputs. The names are the same in every maker’s editor.

TagData typeYour codeWhat it means on the machine
StartBOOLReadsAn input your code needsStart pushbutton
StopBOOLReadsAn input your code needsStop pushbutton
ResetBOOLReadsAn input your code needsReset pushbutton
MixDoneBOOLReadsAn input your code needsMixing finished
HoldBOOLReadsAn input your code needsHold pushbutton
ResumeBOOLReadsAn input your code needsResume pushbutton
PumpOnBOOLWritesAn output your code setsPump command
ValveCmdBOOLWritesAn output your code setsInlet valve command
MixerOnBOOLWritesAn output your code setsMixer command
DoneBOOLWritesAn output your code setsJob complete

In Siemens SCL, write a block’s own tags with # in front, as TIA Portal does: #Start. Rockwell and TwinCAT use the name on its own: Start.

Automatic tests

Hold a job, then resume it: what the tests check

  1. Every state sets all four outputs: pump, valve, mixer and Done.
  2. Held waits for Resume, and only once Hold is released.
  3. Stop works from Running and from Held, and beats Hold, Resume, MixDone and Reset. Reset only works from Complete or Stopped.
  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. Rewind PRO (needs Pro) If one fails, step back through it one scan at a time to see why.

Stuck on this mission? Ask the members in the Locker Room.

Why it matters

Where you’d see this on site

An operator pauses a mixing batch to check the tank, then carries on. If something is wrong, Stop ends the batch.

A job that restarts when Hold is let go can catch the operator out. Stop must win, even when another button is pressed in the same moment.

Where you'd find thisMaking one batch of drink

At a drinks factory, valves let measured amounts of water and syrup into a mixing tank. An electric mixer blends them into one batch. An outlet valve then sends the drink to a holding tank. Filling machines bottle it from there.

  1. Ingredient tanksHold the water and syrup
  2. Mixing tankFill, mix and measure one batchYou are here
  3. Holding tankKeeps the finished drink ready
  4. Bottle fillerPuts the drink into bottles
On a real site: places, parts and safety
  • Drinks factory — blending water and syrup
  • Paint factory — mixing ingredients into a consistent colour
  • Water-treatment works — preparing a measured chemical mixture
  • Brewery — heating water for washing equipment

A full tank does not close its own inlet. Water keeps arriving until the valve closes, so an open inlet can flood the room.

A heater that is not covered by liquid can overheat. Real tanks have separate safety devices as well as the PLC program.

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

Keep going

Next on the road