Esta página aún no está traducida del todo. Lo que falta se muestra en inglés por ahora. Leer la versión en inglés →

Tercer año Lesson 8 of 13 · about 16 min

Intro to PLCs: from relays to ladder logic

What you’ll learn

  • What a PLC is physically: power supply, CPU, input cards and output cards.
  • The scan cycle — read inputs, solve the program, write outputs — and why it matters.
  • How a hard-wired start/stop with a seal-in becomes a few rungs of ladder logic.
  • Why an NC-wired Stop button uses an examine-if-closed instruction, and the safety line a PLC must not cross.

Before this: Reading a ladder diagram · Start/stop and the seal-in

A PLC (programmable logic controller) is an industrial computer that replaces the relays and timers in a control panel with a program. Field devices — pushbuttons, limit switches, sensors — are wired to its inputs; coils, lights and valves are wired to its outputs; and the logic that joins them lives in software. Change the logic and you change the program, not the wiring.

Physically it is a rack or a strip of modules: a power supply, a CPU that holds and runs the program, input cards that turn 24 V DC or 120 V AC from field devices into bits (1 or 0), and output cards — relay, transistor or triac — that switch loads on when the program sets a bit. Every input and output point has a little status light. Those lights are the most useful troubleshooting tool you have.

The scan cycle

1 · Read inputs copy to input image 2 · Solve rungs top to bottom 3 · Write outputs all at once 4 · Housekeep comms, checks one scan a few ms
Every scan, the PLC takes a snapshot of every input, solves the whole program against that snapshot, then updates every output together — and starts again, hundreds of times a second.

Two consequences follow. First, the program sees the world only once per scan: an input that pulses on and off faster than one scan can be missed (fast counting uses special high-speed inputs for that reason). Second, rung order matters — a rung lower down sees the results of the rungs above it in the same scan, but the outputs do not change on the terminals until the whole program is finished.

From a relay rung to a program rung

Take the start/stop circuit from the seal-in lab: Stop (NC) in series with Start (NO), a seal-in contact from the starter in parallel with Start, and the overload contact in series, all feeding the starter coil M. In a PLC panel, the buttons and the overload contact are wired to inputs, and the coil M is wired to an output. The logic moves into the program:

Paro XIC Arranque M seal-in OL M output
The same start/stop logic as a program rung. Every contact here is drawn normally open — including Stop and OL, because those inputs are wired NC and so are ON at rest.

The NC stop-button trap

A contact in a program is not a contact — it is a question about a bit. The two basic instructions are examine-if-closed (XIC, drawn like a normally open contact: “true if the bit is 1”) and examine-if-open (XIO, drawn like a normally closed contact: “true if the bit is 0”).

The Stop button is wired normally closed to its input, so a broken wire acts like a press and stops the machine. That means the Stop input bit is 1 at rest. To let the rung through at rest you want “true if the bit is 1” — an XIC. Beginners see the word Stop, reach for the normally-closed-looking XIO, and the rung is false at rest: the motor never starts. Rule: choose the instruction from the state of the bit, not the name of the button.

Worked: trace the rung through one start

  1. At rest: Stop bit = 1 (NC closed), Start bit = 0, OL bit = 1 (NC closed), M = 0. Rung: XIC Stop true, Start false, M branch false → M stays off.
  2. Press Start: next scan reads Start = 1. Stop true, Start true, OL true → rung true → M bit set to 1; at the end of the scan the output turns on and the starter pulls in.
  3. Release Start: Start = 0, but the M branch is now true (M = 1) → sealed in.
  4. Press Stop: Stop bit = 0, XIC Stop false → rung false → M = 0 → motor stops; the seal-in drops with it.
  5. If the Stop wire breaks, the input goes to 0 exactly as if pressed — the machine stops. That is the reason for wiring it NC.

Inputs, outputs and what to wire where

Match the device to the card: a 24 V DC sensor on a 24 V DC input, a 120 V AC limit switch on an AC input. DC cards come as sinking or sourcing, and the field device has to be the opposite kind so current has a path. Output cards have limits too: a transistor output switches small DC loads, a relay output switches AC or DC but wears and is slow, and a big contactor coil may need an interposing relay. The card’s data sheet gives the ratings.

The line a PLC must not cross. Emergency stops and guard interlocks are built with hard-wired or safety-rated devices (a safety relay or a safety PLC) that remove power whatever the standard program is doing. A standard PLC can be told the e-stop was pressed; it should never be the only thing that stops the machine.

En la obra

Tips

  • Use the I/O lights as a first meter: input light on means the card sees voltage; output light on means the program turned it on.
  • Input light wrong? The problem is in the field wiring or the device. Output light on but the load is off? Look past the terminal — fuse, wiring, coil, common.
  • Go online and watch the rung: the software highlights true instructions, so you can see which one is holding the rung false.
  • Label every force you apply and remove it before you leave. Log it if the site has a force log.
  • Keep a current copy of the program off the machine, with the date.

Common mistakes

  • Using an XIO for an NC-wired stop — the motor never starts.
  • Wiring a sinking sensor to a sinking card (or sourcing to sourcing), then blaming the sensor.
  • Driving a large coil straight off a small transistor output.
  • Assuming a rung lower in the program has already changed a real output this scan.
  • Relying on the program for an emergency stop.
  • Leaving a force on.

Check yourself

0 right of 0 answered 8 questions · pick one answer each

  1. 1.In what order does a PLC do its work on every scan?

  2. 2.A Stop button is wired NORMALLY CLOSED into a PLC input, as it should be. With nobody touching it, the input light on the card is…

  3. 3.Following on: which instruction should the program use for that NC-wired Stop input in the run rung?

  4. 4.What is the PLC's "input image"?

  5. 5.In a hard-wired start/stop circuit, the seal-in is an auxiliary contact on the starter. In the usual PLC version, the seal-in is…

  6. 6.A PLC output light is ON but the contactor it drives has not pulled in. The best next check is…

  7. 7.Why should an emergency stop not rely only on a PLC input and the program?

  8. 8.A two-wire, 24 V DC proximity sensor is wired to a "sinking" input card. What does sinking describe?

Preguntas frecuentes

Is ladder logic the same as a ladder diagram?

It looks the same on purpose. PLC ladder logic was designed so electricians who read relay ladder diagrams could read programs on day one. The difference is that a relay ladder shows real wires and real contacts; ladder logic shows instructions that test bits in memory. A contact in the program is a question ("is this bit on?"), not a piece of metal.

Do I need to know a particular brand?

Not to understand them. Allen-Bradley (Rockwell), Siemens, Omron, Schneider and others all read inputs, solve logic and write outputs; they differ in addressing, software and names for the same instructions. Learn the idea on one, and a second brand takes days, not months.

Can I change a running program?

Many PLCs allow online edits, and forcing an input or output on or off from the laptop. Both change what a real machine does while people may be near it. Treat an online edit or a force like any other energised work: know exactly what it will move, tell the operators, and follow the site's procedure. Forces left on are a well-known cause of machines behaving "impossibly" weeks later.

Ver también

¿Ve algo incorrecto en esta página? Repórtelo

Incluiremos esta página y los números que usted escribió. Leemos cada reporte, pero no podemos responder.

Gracias — su reporte fue enviado.

No se pudo enviar. Vuelva a intentarlo más tarde.