← All exercises

Conditional Sequencer

medium

Advances each step only when that step's own completion input is on.

What it teaches

Builds on Single-Trigger Sequencer by giving each state its own transition condition. Start enters Step 1, then separate Done inputs advance Steps 1, 2, and 3. Inputs for other states are ignored, providing the foundation for sequences driven by sensors, timers, permissives, and operator confirmations.

Inputs and outputs

TagTypeDefaultDescription
In_StartBOOLStarts Step 1 from Idle
In_Step1DoneBOOLAdvances Step 1 to Step 2
In_Step2DoneBOOLAdvances Step 2 to Step 3
In_Step3DoneBOOLCompletes Step 3 and returns to Idle
In_ResetBOOLReturns the sequencer to Idle
Sts_Step1ActiveBOOL1 only while Step 1 is active
Sts_Step2ActiveBOOL1 only while Step 2 is active
Sts_Step3ActiveBOOL1 only while Step 3 is active
Sts_StepDINT0=Idle, 1=Step1, 2=Step2, 3=Step3

Required behavior

  • A fresh block starts in Idle with Sts_Step at 0 and all active-step flags off.
  • In_Start advances Idle to Step1. In_Step1Done advances Step1 to Step2, In_Step2Done advances Step2 to Step3, and In_Step3Done returns Step3 to Idle.
  • Only the transition input assigned to the current step can advance the sequence; inputs assigned to other steps are ignored.
  • At most one transition occurs per scan, even when several transition inputs are on together.
  • Exactly one active-step flag is on in Steps 1-3. All active-step flags are off in Idle.
  • In_Reset wins over every transition input and returns the sequencer to Idle.