PLC Sim Lab
Beginner exercise · timers, set / reset

Pedestrian crossing: a chain of on-delay timers

A push button, a three-colour car signal and a walk signal: the classic exercise for learning how a chain of on-delay timers turns one button press into a timed sequence. Fully solved, in four PLC families.

Worked solution with video · Updated 2026-10-02

Loads the panel and the ladder program from the video. Press RUN PLC and try it.

Other PLC families:

The task

A road has a pedestrian crossing with a push button. The car signal is a three-colour tower light and the walk signal has two lamps, WAIT (red) and WALK (green). Normally the cars have green and the walk signal shows WAIT. When a pedestrian presses the button:

  1. the cars keep green for 2 seconds, so a car that is already close can pass;
  2. the cars get amber for 3 seconds;
  3. the cars get red, and the walk signal shows WALK for 6 seconds;
  4. WAIT comes back, and after 2 seconds of all red (so the last pedestrian can clear the road) the cars get green again.

A press while the sequence is running must not restart or lengthen it. This is one of the most common PLC exercises, because it teaches the single most useful pattern in sequential control: a chain of on-delay timers.

Inputs and outputs

Here with Siemens-style addresses; the other three PLC families are in the solution below.

AddressSignalDevice
I0.0PUSH button (input)green push button, normally open
Q0.0CARS redtower light R
Q0.1CARS ambertower light Y
Q0.2CARS greentower light G
Q0.3WAITred lamp
Q0.4WALKgreen lamp
M0.0crossing requestedinternal memory bit
T0 / T1 / T2 / T3the four timerson-delay timers

Thinking it through

The button is only pressed for a moment, but the sequence takes 13 seconds. So the first job is to remember the request: the button sets a memory bit, and the bit stays on until the sequence is finished. A set / reset pair is clearer here than a seal-in, because the bit is switched on and off in two different places.

Next, the time steps. Instead of one timer with many comparisons, use four on-delay timers in a chain: the request bit starts the first timer, the done bit of each timer starts the next one. Each timer is one step of the sequence, so the times can be read and changed directly: 2 s, 3 s, 6 s and 2 s. When the last timer is done, it resets the request bit. That switches off the first timer, which switches off the second, and so on: the whole chain falls back to zero by itself, ready for the next press.

The lights then need no memory of their own. Each one is just a combination of timer bits:

LightOn whenWhy
Cars greenfirst timer not donecovers normal running and the first 2 s
Cars amberfirst timer done and second not donethe 3 s amber step
Cars redsecond timer donewalk time and the 2 s clearance
WALKsecond timer done and third not donethe 6 s walk step
WAITWALK offalways the opposite of WALK

Writing the outputs this way has a safety benefit: cars green and WALK can never be on together, because one needs the first timer off and the other needs the second timer on, and the second timer cannot run before the first is done.

The solution in four PLC families

The logic is identical; only the addresses, the instruction names and the way the timer preset is written change. Siemens counts presets in milliseconds, the FX-style Mitsubishi and TOYOPUC timers count in 0.1 s steps (K20 = 2 s), and the MicroLogix-style timers here use a 0.01 s time base. On Allen-Bradley the contact for a finished timer is its /DN (done) bit.

Siemens S7-1200 style

RungContactsOutputWhat it does
1NO I0.0S (set) M0.0the button stores the request
2NO M0.0TON T0, PT 2000 ms2 s more green
3NO T0TON T1, PT 3000 ms3 s amber
4NO T1TON T2, PT 6000 ms6 s walk
5NO T2TON T3, PT 2000 ms2 s all red
6NO T3R (reset) M0.0sequence done: every timer resets
7NC T0coil Q0.2cars green
8NO T0, NC T1coil Q0.1cars amber
9NO T1coil Q0.0cars red
10NO T1, NC T2coil Q0.4WALK
11NC Q0.4coil Q0.3WAIT whenever WALK is off
The Siemens video: watch on YouTube

Mitsubishi MELSEC FX style

RungContactsOutputWhat it does
1LD / AND X0SET M0the button stores the request
2LD / AND M0OUT T T0, K202 s more green
3LD / AND T0OUT T T1, K303 s amber
4LD / AND T1OUT T T2, K606 s walk
5LD / AND T2OUT T T3, K202 s all red
6LD / AND T3RST M0sequence done: every timer resets
7LDI / ANI T0OUT Y2cars green
8LD / AND T0, LDI / ANI T1OUT Y1cars amber
9LD / AND T1OUT Y0cars red
10LD / AND T1, LDI / ANI T2OUT Y4WALK
11LDI / ANI Y4OUT Y3WAIT whenever WALK is off
The Mitsubishi video: watch on YouTube

Allen-Bradley MicroLogix style

RungContactsOutputWhat it does
1XIC I:0/0OTL B3:0/0the button stores the request
2XIC B3:0/0TON T4:0, PRE 200 (0.01 s)2 s more green
3XIC T4:0/DNTON T4:1, PRE 300 (0.01 s)3 s amber
4XIC T4:1/DNTON T4:2, PRE 600 (0.01 s)6 s walk
5XIC T4:2/DNTON T4:3, PRE 200 (0.01 s)2 s all red
6XIC T4:3/DNOTU B3:0/0sequence done: every timer resets
7XIO T4:0/DNOTE O:0/2cars green
8XIC T4:0/DN, XIO T4:1/DNOTE O:0/1cars amber
9XIC T4:1/DNOTE O:0/0cars red
10XIC T4:1/DN, XIO T4:2/DNOTE O:0/4WALK
11XIO O:0/4OTE O:0/3WAIT whenever WALK is off
The Allen-Bradley video: watch on YouTube

JTEKT TOYOPUC

RungContactsOutputWhat it does
1STR / AND X000SET M000the button stores the request
2STR / AND M000TMR T000, K20 (0.1 s)2 s more green
3STR / AND T000TMR T001, K30 (0.1 s)3 s amber
4STR / AND T001TMR T002, K60 (0.1 s)6 s walk
5STR / AND T002TMR T003, K20 (0.1 s)2 s all red
6STR / AND T003RST M000sequence done: every timer resets
7STRN / ANDN T000OUT Y002cars green
8STR / AND T000, STRN / ANDN T001OUT Y001cars amber
9STR / AND T001OUT Y000cars red
10STR / AND T001, STRN / ANDN T002OUT Y004WALK
11STRN / ANDN Y004OUT Y003WAIT whenever WALK is off
The TOYOPUC video: watch on YouTube

Test it

  1. Press RUN PLC. CARS shows green, WAIT is lit.
  2. Press PUSH. Nothing changes for 2 s, then amber for 3 s.
  3. Cars red and WALK green for 6 s. Open the monitor (Tag monitor) and watch the four timers count one after another.
  4. WAIT comes back, 2 s later the cars are green again. Press PUSH during the sequence: nothing changes.

Common mistakes

Variations to try

Try it yourself

Build it from scratch in the free PLC Sim Lab Playground, or open the finished solution and change it:

Loads the panel and the ladder program from the video. Press RUN PLC and try it.

Other PLC families:

Frequently asked questions

Why use four timers instead of one?

Each timer is one step of the sequence, so every time can be read and changed on its own, and the light logic stays simple: each light depends only on which timers are done. With one timer you would need several comparisons of its elapsed time.

How does the chain reset?

The last timer resets the request bit. That switches off the first timer, whose done bit then switches off the second, and so on, so the whole chain returns to zero within a few scans.

What happens if the button is pressed during the sequence?

The request bit is already set, so setting it again changes nothing. The sequence is neither restarted nor lengthened.

More: all PLC exercises · free PLC course with certificate · PLC timers and counters · ladder logic basics