Back to courseLesson 3 of 6

Two bits, four programs

What you'll learn

Select the robot's program the PNS way — a binary number on two wires — and read the live echo word back with a compare box.

A robot that always runs the same program is a very expensive cam. Real cells pick the work — part A or part B, weld or dress, day shift recipe or changeover — and the classic way to pick it costs exactly two wires.

Binary on two bits

The select bits are a number in disguise: P1 is worth 1, P2 is worth 2.

P2P1PROGthe robot runs
offoff0nothing — start refused
offon1program 1 — 3.0 s cycle
onoff2program 2 — 4.5 s cycle
onon3program 3 — 6.0 s cycle

This is the PNS idea — program number select — and it scales: five bits pick from 31 programs. The template wires each bit to a selector switch:

r0  ──[SS1]────────────────────( RB1.P1 )
r1  ──[SS2]────────────────────( RB1.P2 )
r2  ────────────────────────────( RB1.EN )      ← lab shortcut!
r3  ──[PB1]──[RB1.RDY]─────────( RB1.START )
r4  ──[ RB1.PROG = 3 ]─────────( PL1  PROG 3 )

Zero selects nothing on purpose. With both switches off the robot refuses the start — no program is an instruction to stand still, not a default. The cycle times differ per program for a reason too: you can hear the selection on a stopwatch, not just see it on a bit.

The echo word

Rung 4 is new territory: a compare box reading RB1.PROG — the robot echoing the number it currently sees on its select bits. Two subtleties make this word worth wiring:

  • The echo is live. Flip a selector mid-cycle and PROG changes immediately — but the running cycle doesn't. The robot latched its program at the start edge. The echo tells you what the next start will run.
  • It closes the loop. Your ladder thinks it selected program 3; the echo is the robot confirming it. Rung 4 turns that confirmation into a lamp — the same move as any feedback circuit: command, then verify.

The shortcut you never ship

Look at rung 2: the enable tied straight to the rail. On a bench, fine — this template is a bench. In a cell, that wire is the difference between a machine and an accident: nothing between power-up and an armed robot. What belongs on that rung is the whole next module.

Run it

Open the program-select circuit:

  1. Both switches off — press start. Refused: PROG reads 0.
  2. SS1 on — one cycle, count it: about three seconds.
  3. Both on — PROG echoes 3, the lamp lights, and the cycle runs six seconds.
  4. Start a cycle on program 1, then flip SS2 mid-cycle: the echo jumps to 3, the countdown keeps its pace — latched versus live, on one screen.

Check your understanding

Question 1 of 2

SS1 (P1) is on and SS2 (P2) is on. What does RB1.PROG read, and what happens on START?

Next lesson