Conveyor station
Ladder logic · MainRoutine
Drag a button onto a rung, or drag placed instructions and branches to move them. Drag the small square at either end of a branch to stretch or shrink it. To change an instruction, select it and type a new mnemonic (e.g. XIO).
- warningRung 0 is empty.
Objectives
- Latch the conveyor on with a momentary Start, and unlatch it with Stop.
- Stop the conveyor automatically when a box reaches the photoeye.
- Let Start move a parked box past the eye, then stop at the next box.
- Create your own internal tag for a one-shot storage bit.
Latch and unlatch
OTL (Output Latch) sets its bit to 1 when its rung is true. Unlike OTE, a false rung does NOT clear it. The bit stays 1 until an OTU (Output Unlatch) on another rung clears it.
Latched bits are retentive: they keep their value through a PROGRAM/RUN mode change. On real equipment that means a latched motor can restart when the controller goes back to RUN, which is why seal-ins are often preferred for motors. Here, latches make the logic easy to read.
When both are true, the last rung wins
If Start and Stop are pressed together, the latch rung and the unlatch rung are both true in the same scan. Rungs run top to bottom, so whichever writes the bit last decides the output for that scan. Put the Stop unlatch below the Start latch so Stop always wins.
Why you need a one-shot
The obvious rung is "if the photoeye is ON, unlatch the motor". It stops the first box, but it also stops the conveyor again the moment you press Start, because the parked box is still blocking the eye.
What you really want is "when a box ARRIVES": the instant the photoeye goes from OFF to ON. ONS (One Shot) passes power for exactly one scan when its rung goes from false to true, then blocks until the rung goes false again.
ONS needs a storage bit, a BOOL that remembers whether the rung was true on the last scan. Use a new internal tag for it, never an input or output. Click "+ New tag" in the tag monitor (or choose "New tag…" in an instruction's tag list) and name it something like PE_ONS.
Steps
- Rung 0: XIC(Start_PB) → OTL(Conveyor_Motor).
- Add a rung. XIC(PE_Box_Present) → ONS(new tag PE_ONS) → OTU(Conveyor_Motor).
- Add a last rung: XIO(Stop_PB) → OTU(Conveyor_Motor). Stop is wired N.C., so XIO is true while Stop is pressed.
- Run the PLC and press Start. Watch the first box stop at the photoeye, then press Start to send it on.
- Try this: replace the ONS with nothing and see why Start cannot move the parked box.
- When it works, click Grade my program.
Stuck? Show hints
- If the conveyor stops but Start cannot move the parked box, the photoeye rung is level-triggered. Insert an ONS after XIC(PE_Box_Present).
- If an ONS will not accept your tag, it needs an internal tag. Create one; inputs and outputs are not allowed.
- If Stop does not win with both buttons held, move the Stop unlatch rung below the Start latch rung.
- If Stop does nothing, remember Stop_PB is ON at rest: unlatch on XIO(Stop_PB).
Tag monitor
| Tag | Type | Value |
|---|---|---|
Start_PB Start pushbutton | input DI 0 · N.O. contact | 0 |
Stop_PB Stop pushbutton | input DI 1 · N.C. contact | 0 |
PE_Box_Present Photoeye, ON when a box blocks the beam | input DI 2 · PNP sensor | 0 |
Conveyor_Motor Conveyor motor starter coil | output DO 0 · starter coil | 0 |