LearnPLC Final Review

PLC Final Review

Everything the PLC final covers, in one pass: the hardware and the scan, discrete and analog, input and output modules, addressing, examine if closed and open, timers, counters, compare and data instructions, number bases and troubleshooting. Each part is short and points to the full lesson. Finish on the practice test.

01

Hardware, Memory and the Scan

What a PLC is made of, where the program and the data live, and what the processor does over and over. A PLC takes in inputs, makes decisions from the program and energizes outputs. The difference from a relay panel is that the logic is a program, not wiring.

The five partsclick a part
Fixed

Built-in I/O, unchangeable. Processor, supply and terminals in one housing. Everything addresses to slot 0.

Modular

You choose the cards and where they go. The processor is slot 0, so the first I/O module is slot 1 - count past the processor. The card's slot becomes the middle of its address.

The backplane

The chassis is not just a shelf to hang cards on. Running along the back of it is the backplane, and the backplane provides power and communication: it feeds every module from the power supply, and it carries the data between the processor and each card. That is what lets a processor in slot 0 read an input card in slot 3 without a single wire running between the two.

Pull the plugvolatile and non-volatile

Volatile memory (RAM) loses its contents without power, unless a battery keeps it alive. Non-volatile memory (ROM, EEPROM and flash) keeps its contents with no power at all. The user program has to survive an outage, so it is kept in battery-backed RAM or in non-volatile memory.

Organized another way, memory is two halves: program files hold the ladder, and data files hold what the ladder works with: the input and output images, bits, timers, counters and numbers.

Scan cycle Step 1 of 4

Full lesson: The five parts The scan cycle Memory

02

Discrete and Analog

Discrete is on or off, one bit. Analog varies continuously, so the PLC stores it as a number.

Sort the devices 0 of 12 placed

Drag each device into a bin, or tap one and then tap a bin. Nothing is marked until you press Check.

Discrete

ON / OFF - a single bit

Analog

A range of volts or milliamps
Unipolar

Varies in the positive only: 0 to 5 V or 0 to 10 V.

Bipolar

Varies positive and negative: -5 to +5 V or -10 to +10 V.

Discrete or analog, and the ranges
DiscreteAnalog
SignalOn or offA range of volts or milliamps
In the data tableOne bitOne 16-bit word, a number
InputsPushbutton, limit switch, proximity sensor, floatThermocouple, RTD, pressure or level transmitter
OutputsPilot light, horn, motor starter coil, solenoidDrive speed reference, proportional valve

Ranges

RangeType
0 to 5 VUnipolar
0 to 10 VUnipolar
-5 to +5 VBipolar
-10 to +10 VBipolar

Full lesson: Discrete and analog, unipolar and bipolar

03

I/O Modules and Wiring

An input card senses the field and tells the processor. An output card switches the load, and the kind of card decides which loads it can switch.

Output module typespick a card, flip the bit

A discrete output card turns a load on and off. What is inside it, between the output terminal and the supply, decides which loads it can switch: a relay contact, a triac or a transistor. Pick a card, then turn the bit on and off. Try a card on the wrong supply too.

Sinking and sourcing, from the module's point of view

A sinking module returns current through its common to the negative. A sourcing module supplies the positive. The pair always has to be one of each.

ModuleIts common goes toThe field sidePairs with
Sinking input0 VThe device brings +24 V to the input terminalA sourcing device, such as a switch fed from +24 V
Sourcing input+24 VThe device connects the input terminal to 0 VA sinking device, such as a switch wired to 0 V
Sinking output0 VThe load runs from +24 V to the output terminal. On, the terminal reads about 0 V.A load fed from the positive
Sourcing output+24 VThe load runs from the output terminal to 0 V. On, the terminal reads about 24 V.A load returned to the negative

Two sinks never complete a circuit, and neither do two sources. Match the pair first, then check the card's own label.

Open it in Basics →

Full lesson: Sinking and sourcing

04

Addressing and the Image Tables

Every bit, timer and number has an address: the file it is in, then where in the file.

I:1/3

I is the file type, an input. 1 is the slot the card is in. 3 is the bit, counted from 0. A 16-point card has bits 0 to 15, so the fifth point down is bit 4.

AddressFileReads as
I:1/3Input imageInput, slot 1, bit 3
O:2/0Output imageOutput, slot 2, bit 0
B3:0/5Bit file 3Word 0, bit 5. Internal bits, the control relays of a PLC.
T4:2/DNTimer file 4Timer 2, its DN bit. Also T4:2.PRE and T4:2.ACC as numbers.
C5:1/DNCounter file 5Counter 1, its DN bit. Also C5:1.PRE and C5:1.ACC.
N7:10Integer file 7Word 10, a 16-bit number. N7:10/3 is bit 3 of that word.

Fixed or modular

A slot of 0 in an I or O address is a fixed PLC, where all the I/O is built in. In a modular rack the CPU is in slot 0, so the I/O cards start at slot 1 and the slot number is part of every address.

This site builds every rack in one order: CPU in slot 0, then the discrete input cards, then discrete outputs, then analog inputs, then analog outputs, with no gaps.

Slot 0Slot 1Slot 2Slot 3Slot 4
CPU16 point discrete input
I:1/0 to I:1/15
16 point discrete output
O:2/0 to O:2/15
Analog inputAnalog output
How a field input gets to the input image table

Two pictures of the same point. The card's light shows the terminal right now. The ladder's highlight shows the image bit, which is as old as the last input scan. They can disagree for a scan, and when they disagree for longer something is wrong.

Open it in Basics →

Full lesson: Fixed and modular I/O The scan and the image tables

05

Examine if Closed and Examine if Open

Two instructions look at a bit. XIC is true when the bit is 1. XIO is true when the bit is 0. That is all they do, and every rung is these in series and parallel in front of an output.

True or false, against the bit

The whole table

Field deviceInput bitXICXIO
Normally open, at rest0falsetrue
Normally open, actuated1truefalse
Normally closed, at rest1truefalse
Normally closed, actuated or the wire broken0falsetrue

Choosing one

Choose from what you need the bit to be, not from the symbol on the device. The bit tells you what the field wiring did.

  • A normally open start button, run while pressed: XIC.
  • A normally closed stop button, run while it is not pressed: XIC. At rest the bit is 1, and a broken wire stops the machine.
  • A normally open overtemperature switch that closes when hot, run only while it is not: XIO.
  • An XIO on a normally open device nobody has actuated is true from the first scan in RUN.
Series, parallel and gates in ladder

Series is AND, parallel is OR, XIO is NOT. The other gates are built from those three:

GateIn ladder
ANDContacts in series
ORContacts in parallel
NOTAn XIO
NANDXIOs in parallel (any input off turns it on)
NORXIOs in series (all inputs off turns it on)
XORTwo paths: A and not B, or not A and B

Full lesson: XIC or XIO Logic gates, three ways to say it

06

Timers

TON delays turning on, TOF delays turning off, RTO adds up time and remembers it. A timer instruction has no contacts of its own. It sets bits in its timer file element, and other rungs use those bits with XIC and XIO instructions. For a timer at T4:0:

EN · T4:0/EN
Enable. Follows the rung the timer is on. True rung, EN is 1. It does not wait for anything.
TT · T4:0/TT
Timer timing. 1 only while the accumulator is counting toward the preset.
DN · T4:0/DN
Done. The timed contact. What it does depends on the timer type, and that is the whole point of the tables below.
ACC · T4:0.ACC
Accumulated value. How much time has counted so far, in time-base units.
PRE · T4:0.PRE
Preset. The target. A preset of 50 on a 0.1 s time base is 5 seconds.
TONtimes while the rung is true

Timer on-delay. It times while its rung is true. If the rung goes false at any point, before or after done, everything resets: all three bits off and the accumulator back to 0.

Energized and Timing read the same: TT comes on the same scan the rung goes true. The only difference is that ACC has started counting.

TOFtimes while the rung is false, after it was true

Timer off-delay. DN comes on with the rung, and the timing starts when the rung goes false. DN holds until the time runs out. If the rung goes true again while it is timing, ACC resets to 0 and DN just stays on.

The columns are in the same order as the off-delay relay table, because the story is the same: on, off, timing, done.

RTOkeeps its time until RES

Retentive timer on. It times while the rung is true like a TON, but a false rung only pauses it: ACC holds where it stopped and picks up from there. Once DN is on it stays on, true rung or not, until a RES instruction with the same address clears it.

There is no common timer relay that does this. The closest thing on a panel is an hour meter: it keeps its count with the power off.

Pick a timer, then switch its rung true and false and watch the bits, the accumulator and the relay contacts that do the same thing. The preset is 5 seconds.

Bench
Deenergized
ACC 0.0 / PRE 5.0 s
The relay contacts that do the same thing
Time base and preset

Time = preset x time base. The common bases are 1.0 s, 0.1 s, 0.01 s and 0.001 s.

BasePresetTime
0.1 s454.5 s
0.01 s120012 s
1.0 s9090 s
0.01 s2502.5 s
0.001 s32003.2 s

Timer programs

Three jobs timers do on almost every machine: flash a light, delay a start, and clean up a noisy sensor. Some of them are written more than one way, so flip between the versions and compare. Every ladder here runs live. Push the buttons and watch power move through the rungs.

Full lesson: Timers Timer patterns

07

Counters

A counter counts false-to-true transitions of its rung, not how long the rung is true. One box in front of an eye for a minute is one count.

PartWhat it does
CTUAdds 1 to ACC on each false-to-true transition of its rung.
CTDSubtracts 1. It does not stop at zero, it goes negative.
PRE and ACCThe count you want, and the count so far. Counting carries on past the preset.
CU, CDOn while the count-up or count-down rung is true. The counter uses them to tell a new transition from a rung that is still true.
DNOn whenever ACC is at or above PRE.
OV, UNOverflow past 32,767 counting up, underflow past -32,768 counting down.
RESClears ACC and the status bits. A counter is not reset by its rung going false, and it keeps its count through a power loss.

Full lesson: Counters One-shots and self-resetting counters

08

Compare and Data

Compare instructions sit on a rung like a contact and are true or false on numbers. Data instructions move and change whole words, 16 bits at a time, not single bits.

Compare instructions
InstructionTrue when
EQU A, BA equals B
NEQ A, BA does not equal B
LES A, BA is less than B
LEQ A, BA is less than or equal to B
GRT A, BA is greater than B
GEQ A, BA is greater than or equal to B

A value that updates in steps can jump past an exact number. Use GEQ or LEQ for "reached or passed", and save EQU for counts that move one at a time.

Try them

LIM, the limit test

LIM has a low limit, a test value and a high limit. The limits themselves count as inside or outside.

  • Low limit at or below the high limit: true when Low ≤ Test ≤ High. The usual "is it in the band" test.
  • Low limit above the high limit (inverted): true when Test ≥ Low or Test ≤ High. Now it is true outside the band.

A temperature alarm that must come on at 85 or above, or at 25 or below:

MOV and ONS

MOV copies a value (a number or another word) into a destination word. Like any output instruction it runs on every scan its rung is true. ONS (one-shot) is true for one scan when the conditions in front of it go from false to true, then stays false until they go false and true again. Each ONS needs a bit of its own to remember last scan.

A short program: the case packer

Bags are counted into a case. A selector sets the case size, 6 bags or 12, by moving a preset into the counter. The case full gate closes on the counter's DN, a limit test checks the case weight in grams, and a reset clears the count when the case is pulled.

  • Rungs 0 and 1 load the preset: large case (I:1/10 on) moves 12 into C5:2.PRE, otherwise 6.
  • Rung 2 counts one per bag. RES clears CU along with ACC, so a bag still sitting on the eye when the case is pulled would be counted again into the next case, which would start at 1 instead of 0. The ONS makes the rung true for one scan per bag, so a bag that sits there is counted once.
  • Rung 3 closes the gate when C5:2 reaches its preset.
  • Rung 4 turns on O:2/9 only while the weight in N7:2 is 480 to 520 inclusive.
  • Rung 5 resets the count.

Full lesson: One-shots Counters

09

Number Bases

The final asks two conversions: decimal to binary, and binary to decimal. Both start from the place row.

Building the place row

Both conversions need the places written out first, and you never have to remember them. Start at the ones column and multiply by the base to get the next one going left. That is the whole rule, and it works in every base.

The previous place times the base base 2

Decimal to binary

Biggest that fits, how many fit, what is left over, repeat. The strip below lays the places out the way you would on paper, each one the previous times the base, and the line under every place says which one it came from. Fill them left to right and watch the leftover come down to nothing.

Convert from decimal to binary
Left over100

Binary to decimal

What is the value of the place, how many are there, multiply, add them all up. The digits are given. Fill in what each place is worth in total, then the sum.

Convert to decimal from binary
Add them up

Full lesson: Number Bases Practice run

10

Troubleshooting

120 VAC across two rails. Wire 1 feeds a limit switch, wire 2 carries on to a pressure switch, wire 3 feeds the pilot light and wire 4 returns to neutral. A pushbutton bridges wire 1 straight to wire 3, in parallel with the two switches, so the light comes on either when LS and PS are both made, or when the button is pressed.

Live circuit Drag the probes
How to work it
  • Drag the red and black probes from the meter onto any two terminals.
  • Click LS or PS to make or break them, they stay where you put them. The PB is momentary: hold it down.
  • The wires are deliberately drawn one colour. The meter is the only thing that tells you what is live, which is the point.
Readings to take
  • 1 to 4, everything open. That is the supply, and it is there whether anything is running or not.
  • 1 to 2 with LS open, then made. A made contact puts both ends on the same wire.
  • 3 to 4 with LS and PS both made. Everything the source gives you lands across the load.
  • Now hold the PB instead. Same lamp, different path.
The same readings on a three-phase starter
  • Line side to line side, 1 to 3: the supply, 480 V, whether the starter is in or out.
  • Starter pulled in, across one main contact, 1 to 2: about 0 V. A made contact puts both ends on the same wire.
  • Starter pulled in, line side of one pole to load side of another, 1 to 6: 480 V, phase to phase through two made contacts.
Open the full troubleshooter →
11

Practice Test

Twenty-six questions across everything above, weighted toward bit status, timers, sinking and sourcing, and compare and LIM. Wrong answers explain themselves.

Sinking and sourcing are named on this page from the module's point of view, matching the Sinking vs Sourcing walkthrough in Basics: a sinking module returns current through its common to the negative rail, and pairs with a sourcing field device. Some texts name the same circuit from the field device instead, which flips the word - use the convention your instructor uses in class.