PLC (Programmable Logic Controller)
Complete Study Notes & Interview Preparation Guide
Software Used TIA Portal V15.1
PLC Hardware Siemens SIMATIC S7-1200, CPU 1214C DC/DC/RLY
Analog Module SM 1234 AI/AQ (6ES7 234-4HE32-0XB0)
Compiled From Handwritten PLC lab notes + hardware photographs
1. Automation & Control Systems — Basics
1.1 What is Automation?
Automation is the delegation of human control functions to technical equipment, aimed at achieving:
• Higher productivity
• Superior quantity of end product
• Efficient usage of energy and raw material
• Improved safety in working conditions
In short: automation is the use of computerized or robotic devices to complete manufacturing tasks with minimal
human intervention.
1.2 Types of Automation
Type Examples
Building Automation Lifts, automatic doors
Office Automation Printers, CCTV
Scientific Automation Rockets, spacecraft
Light Automation Street / solar lighting
Industrial Automation Automated bottle-filling stations, steel factories
1.3 Development of Control Systems (Evolution)
• Manual Control — human operated
• Pneumatic Control — compressed-air based
• Hard-Wired Relay Logic Control — physical relays and wiring
• Electronic Control — solid-state electronic circuits
• PLC Control — programmable, software-based control (current standard)
1.4 General Control-System Flow
Plant ↔ Field Instruments ↔ Control System (further split into Hardware Control ↔ Software Control)
1.5 What is a PLC?
A Programmable Logic Controller (PLC) is an industrial control computer that continuously monitors inputs,
makes decisions based on a stored program, and controls outputs to automate a process or machine. The
automation of processes such as controlling machines or factory assembly lines is carried out using these small
industrial computers called PLCs.
1.6 Why PLC?
• To reduce human effort
• To maximize efficiency from machines and control them with programmed logic
• To reduce the complex circuitry of an entire relay-based system
• To reduce the high costs associated with inflexible, relay-controlled systems
• Machines can be controlled without continuous human effort
2. Major Components of a PLC
Power Supply
From Sensors /Input Processor Output
Push Buttons Module Module To Output
(CPU)
Programming
Device
2.1 Components
(i) Input Modules
Accept and convert signals from sensors into a logic signal usable by the CPU. Examples: switches, push
buttons.
(ii) Output Modules
Convert control instructions into a signal that can be used by actuators. Examples: lamps, alarms.
(iii) CPU (Processor)
The brain of the PLC — governs the activities of the entire PLC system. It consists of:
• Arithmetic Logic Unit (ALU)
• Internal memory of CPU
• Internal Timer, Counter and Flag
Operations performed by CPU:
• Scanning I/O bus traffic control
• Program execution
• Peripheral and external device communication
• Data handling and self-diagnostics
(iv) Memory
Stores information, programs and data in the PLC. Types of memory used: ROM and RAM.
(v) Power Supply
Provides the voltage needed to run the primary PLC components.
(vi) Programming Device
The programming terminal (PC + software) is used for programming the PLC and monitoring / sequencing PLC
operations.
Simple Input–Output Concept
Push Button → PLC → Output (e.g., indicator lamp / display)
3. PLC Operation (Scan Cycle)
The PLC continuously repeats a 3-step scan cycle:
1. Check Input Status
2. Execute Program repeat
3. Update Output Status
• Check Input Status — the PLC first looks at each input to determine if it is ON or OFF.
• Execute Program — next, the PLC executes the program one instruction at a time (based on input
states).
• Update Output Status — finally, the PLC updates the output states based on which inputs were ON
during the first step.
This entire check → execute → update sequence is called one scan cycle, and it repeats continuously.
4. PLC Programming — Ladder Logic
Ladder Logic is a graphical programming language used to develop software for PLCs and industrial control
applications. It resembles an electrical relay-logic ladder diagram, made up of two vertical rails (power rails)
and horizontal rungs.
4.1 Basic Elements
Symbol Name Function
—| |— Normally Open (NO) Contact Passes power when the associated bit is 1 (TRUE)
—|/|— Normally Closed (NC) Contact Passes power when the associated bit is 0 (FALSE)
—( )— Coil Output — energized when the rung logic is TRUE
PLC addressing convention used in the notes: Q = Output (Q0.0 to Q0.7) and I = Input (I0.0 to I0.7 and I1.0 to
I1.5).
4.2 Logic Gates Implemented in Ladder Diagram
OR Gate
I0.0 I0.1 Q0.0
—| |———————————( )—
—| |———(A or B)——|
Two NO contacts in PARALLEL. Output C = 1 if A OR B (or both) = 1.
AND Gate
I0.0 I0.1 Q0.0
—| |——| |——————————( )—
Two NO contacts in SERIES. Output = 1 only if both A AND B = 1.
NOT Gate
I0.0 Q0.0
—|/|——————————————( )—
Single NC contact. Output = 1 when input = 0 (inverts input).
NAND Gate
I0.0 I0.1 [NOT] Q0.0
—| |——| |———————————————( )—
AND combination followed by a NOT block → inverted AND.
NOR Gate
I0.0 [NOT] Q0.0
—| |——————————————————————( )—
—| |——|
OR combination followed by a NOT block → inverted OR.
EX-NOR (XNOR) Gate
A I0.0 B I0.1 Q0.0
—| |———| |—————————————————( )—
—|/|———|/|—|
(NOT A) (NOT B)
Output = 1 when A & B are the SAME (both 1, or both 0).
5. Latching / Set-Reset Logic
5.1 Self-Holding (Seal-in) Latch
I0.0 Q0.0
—| |———————————————————————( )—
—| |——| (Q0.0 NO contact in parallel — 'seal-in')
Q0.0
Once I0.0 is pressed momentarily, Q0.0 energizes and its own NO contact
keeps the rung TRUE (latched ON) even after I0.0 is released.
5.2 Set–Reset (Latch with unlatch)
I0.0 I0.1 Q0.0
—| |————————————|/|——————————( )—
—| |——| (I0.1 = Reset/Stop button, NC)
Q0.0
I0.0 sets/latches Q0.0 ON; pressing I0.1 (Reset) breaks the rung and
turns Q0.0 OFF.
5.3 SET (S) and RESET (R) Coil Instructions
Modern ladder software (e.g., TIA Portal) also provides dedicated S (Set) and R (Reset) coil instructions instead
of manual seal-in contacts:
• I0.0 → (S) M0.0 → sets/latches memory bit M0.0 to 1
• I0.1 → (R) M0.0 → resets memory bit M0.0 to 0
• Once Set, the bit stays 1 until explicitly Reset, and vice-versa (retains state even after scan changes).
5.4 NOR / NAND using NOT block (as drawn in notes)
• NOR Gate using NOT: two NO contacts in parallel → [NOT] block → coil.
• NAND Gate using NOT: two NO contacts in series → [NOT] block → coil.
6. Timers in PLC
There are four main types of timers used in PLC programming (IEC standard function blocks):
Timer Full Form Behaviour
TP Pulse Timer Generates a pulse output of fixed duration (PT) starting the moment IN goes TRUE, even if IN is
TON Timer ON-Delay Output (Q) goes TRUE only after the input has been continuously TRUE for the preset time (PT).
TOFF Timer OFF-Delay Output goes TRUE immediately when input goes TRUE. When input goes FALSE, output stays T
TONR Timer ON-Delay Retentive Starts counting when it receives an ON signal; keeps the accumulated time even if the signal turn
Timer block pins: IN (start condition), PT (Preset Time, e.g. T#5s), Q (output), ET (Elapsed Time).
Example: TON — Robot starts 5 s after switch is pressed
I0.0 TON Q0.0
—| |———————[ IN Q ]————————————( )—
T#5s—[ PT ET ]
Example: TOFF — Motor switches off 5 s after sensor deactivates
I0.0 TOFF Q0.0
—| |———————[ IN Q ]————————————( )—
T#5s—[ PT ET ]
Example: Sequential lamps using TP (each ON for 5 s, one after another)
I0.0 —[TP, PT=5s]—( )Q0.0
Q0.0—[TP, PT=5s]—( )Q0.1
Q0.1—[TP, PT=5s]—( )Q0.2
Q0.2—[TP, PT=5s]—( )Q0.3
Each output pulses ON for 5 s, and its trailing edge triggers the next.
7. Programming Software — TIA Portal V15.1
TIA Portal (Totally Integrated Automation Portal) is Siemens' engineering software used to configure, program,
and monitor S7-1200/S7-1500 PLCs.
7.1 Basic Workflow
• Right-click on the PLC device → Open
• PLC → Siemens S7-1200
• Create New Project → give Name → choose Path (save in D: drive or a new folder) → Version V15.1
• Open Project View (left upper side) → click the arrow → Add new device → double-click Controller →
choose S7-1200 or S7-1500 → select exact CPU (e.g. CPU 1214C DC/DC/RLY)
• Program Blocks → Main [OB1] (default main program block)
• Favorites toolbar gives quick access to common instructions
• Instructions panel → (i) General (ii) Bit Logic instructions (contacts, coils, timers, counters, etc.)
• Use Start Simulation (S7-PLCSIM) to test logic without physical hardware — replace the CPU with the
'No action / start module' option
• For Run mode → use Monitoring (Go online, ON/OFF eyeglasses icon) to watch live I/O states
7.2 I/O Addressing Convention Used
• Q (Output) = Q0.0 to Q0.7
• I (Input) = I0.0 to I0.7 and I1.0 to I1.5
8. Lab PLC Hardware Specification
Hardware used in the lab (from module nameplate & terminal photographs):
Make / Brand SIEMENS
Family SIMATIC S7-1200
CPU CPU 1214C DC/DC/RLY (24 VDC supply / 24 VDC input / Relay output)
Signal Module (SM) SM 1234 AI/AQ — Analog Input / Analog Output combo module
Order No. 6ES7 234-4HE32-0XB0
Series / FS S V-K1BJ2575, 2018 — FS: 04
Power Supply 24 VDC, 60 mA, Class 2
Analog Inputs (AI) 4 x 13-bit resolution, ±10 VDC / 0–20 mA
Analog Outputs (AQ) 2 x 14-bit resolution, ±10 VDC / 0–20 mA
Digital Inputs 24 VDC inputs — terminals DI a (.0–.7) and DI b (.0–.5)
Digital / Relay Outputs Relay Outputs — terminals DQ a (.0–.4) and DQ b (.5–.1)
Communication Port X1 P1 — PROFINET (LAN), with LINK and Rx/Tx status LEDs
Analog I/O Terminals X10 (24 VDC), X11 (Analog Inputs — L+, M, 0+/0−, 1+/1−, 2+/2−, 3+/3−), X13 (Analog Outputs —
Certifications visible on module: EAC, CE, KEMA (ATEX), UL Listed, FM Approved (Class I, Div. 2 / Zone 2),
IECEx — indicating suitability for use near hazardous (explosive-atmosphere) locations under specific
conditions.
9. Applications, Advantages & Disadvantages
9.1 Areas of Application
• Manufacturing / Machining
• Food & Beverage industry
• Textile industry
• Travel industry
• Aerospace
• Printing industry
9.2 Advantages
• Replaces human operators in dangerous environments or tasks beyond human capability
• Fast operation
• Easily programmed with an easily-understood programming language (Ladder Logic)
• Improves productivity and quality
9.3 Disadvantages
• PLC devices are proprietary (vendor lock-in)
• Initial costs are high
• Requires extensive field wiring
• Contributes to unemployment (reduced need for manual operators)
10. Interview Questions & Answers
A. Fundamentals
Q: What is a PLC?
A: A Programmable Logic Controller is an industrial digital computer that monitors inputs, executes a stored
user program to make decisions, and controls outputs to automate a machine or process.
Q: What is automation, and why is it used?
• Delegating human control functions to technical equipment.
• Goals: higher productivity, better product quality/quantity, efficient use of energy & raw material,
improved safety.
Q: What are the different types of automation?
A: Building automation (lifts, doors), Office automation (printers, CCTV), Scientific automation (rockets), Light
automation (street lighting), Industrial automation (bottle filling, steel plants).
Q: How did control systems evolve before PLCs?
A: Manual control → Pneumatic control → Hard-wired relay logic control → Electronic control → PLC control.
Q: Why choose a PLC over hard-wired relay logic?
• Reduces human effort and wiring complexity.
• Maximizes machine efficiency with programmable logic.
• Much lower long-term cost than rewiring an inflexible relay system for every change.
• Easy to reprogram / modify logic without rewiring.
B. PLC Architecture
Q: What are the major components of a PLC?
A: Power Supply, Input Module, CPU (Processor), Output Module, Programming Device, and Memory.
Q: What is the function of the CPU in a PLC?
A: It is the 'brain' of the PLC — it governs all system activities: I/O bus traffic scanning, program execution,
communication with peripherals/external devices, data handling and self-diagnostics. It contains the ALU,
internal memory, and internal timers/counters/flags.
Q: What types of memory are used in a PLC?
A: ROM (stores firmware / non-volatile data) and RAM (stores the working program and data).
Q: What is the role of Input and Output modules?
A: Input modules convert field signals (from switches, push buttons, sensors) into logic signals the CPU can
process. Output modules convert the CPU's control instructions back into signals that drive actuators (lamps,
alarms, motors, valves).
Q: Explain the PLC scan cycle.
A: Every cycle has 3 steps repeated continuously: (1) Check Input Status — read all inputs' ON/OFF states;
(2) Execute Program — run the ladder program instruction by instruction using those input states; (3) Update
Output Status — write the resulting output states to the physical outputs.
C. Programming / Ladder Logic
Q: What is Ladder Logic?
A: A graphical PLC programming language resembling a relay wiring ladder diagram, built from two vertical
power rails and horizontal rungs containing contacts and coils.
Q: What are 'rungs' and 'rails' in ladder logic?
A: Rails are the two vertical lines representing power supply; rungs are the horizontal lines between the rails,
each containing the logic (contacts) that controls one or more coils/outputs.
Q: Differentiate Normally Open (NO) and Normally Closed (NC) contacts.
A: An NO contact passes power (is TRUE) when its associated input/bit is 1. An NC contact passes power
when its associated bit is 0 — it is the inverse of the actual physical/logical state.
Q: How do you implement an AND / OR gate in ladder logic?
A: AND: place the contacts in SERIES on one rung. OR: place the contacts in PARALLEL branches feeding
the same coil.
Q: How do you implement a NOT gate?
A: Use a single Normally Closed (NC) contact of the input feeding the output coil — output is energized when
input is OFF.
Q: How do you build NAND / NOR gates in ladder logic?
A: NAND = AND logic (series NO contacts) followed by inverting the result (NOT block / NC output logic).
NOR = OR logic (parallel NO contacts) followed by a NOT block.
Q: What is latching (seal-in) logic and why is it needed?
A: Latching keeps an output ON continuously even after the triggering input returns to OFF, by using the
output's own NO contact in parallel with the start contact to 'seal in' the circuit. It is essential for momentary
push-button start circuits (e.g., motor start/stop stations).
Q: What is the difference between simple latching and Set-Reset (S/R) latching?
A: Simple seal-in latching uses the output's own contact for self-holding and a single NC contact elsewhere to
break the circuit. Set/Reset (S and R coil instructions) are dedicated instructions that directly set a bit to 1 (S)
or clear it to 0 (R), and the bit retains state independently of rung scanning, which is often clearer and safer
for complex interlocks.
Q: If both Set and Reset conditions are true simultaneously, what happens?
A: This depends on scan order — generally whichever instruction (S or R) executes later in the program scan
wins for that cycle. Best practice is to design interlocks so S and R can never be true together.
D. Timers & Counters
Q: What are the different types of timers available in a PLC?
A: TP (Pulse Timer), TON (ON-Delay Timer), TOFF (OFF-Delay Timer), and TONR (Retentive ON-Delay
Timer).
Q: Explain TON vs TOFF.
A: TON delays turning the output ON — the output goes TRUE only after the input has stayed TRUE
continuously for the preset time (PT); if input drops before PT, the timer resets. TOFF delays turning the
output OFF — output goes TRUE immediately with input, but after input goes FALSE, output stays TRUE for
the preset time before switching OFF.
Q: What is a Pulse Timer (TP) used for?
A: It generates a fixed-duration output pulse as soon as it receives an ON trigger — even a very brief
momentary pulse on IN will produce a full PT-duration output. Useful for generating a fixed ON-time
regardless of how long the input signal is held.
Q: What makes a Retentive Timer (TONR) different from a normal TON?
A: A TONR retains its accumulated elapsed time even if the input signal turns OFF partway through timing —
it resumes counting from where it left off next time IN goes TRUE. It only resets to zero via a dedicated Reset
command, unlike TON which resets automatically when input goes FALSE.
Q: Give a practical example of using TON.
A: A robot/motor that must start 5 seconds after a start switch is pressed: wire the switch to the TON block's
IN with PT = T#5s, and the TON's Q output drives the motor/robot output coil.
Q: How would you build a repeating sequence (e.g., 4 lamps, each ON for 5 s in sequence)?
A: Chain TP timers: the first TP is triggered by the start input; its output (Q) feeds the coil for lamp 1 and
simultaneously triggers the next TP for lamp 2, and so on — each TP's falling edge or output can trigger the
next timer in the chain.
E. Software / Practical
Q: What programming software is used for Siemens S7-1200/1500 PLCs?
A: TIA Portal (Totally Integrated Automation Portal), e.g., version V15.1.
Q: What are the basic steps to create a new project in TIA Portal?
• Create New Project → give it a name and save path/version.
• Open Project View → Add new device → select Controller → choose S7-1200 / S7-1500 and exact CPU
model.
• Program the logic inside Program Blocks → Main [OB1] using Bit Logic / General instructions.
• Use Start Simulation (PLCSIM) to test the logic offline.
• Go online / Monitoring mode to observe live I/O status on real hardware.
Q: How do you test a ladder program without physical hardware?
A: Using TIA Portal's built-in Start Simulation feature (S7-PLCSIM), which emulates a virtual CPU so the
program logic and I/O can be tested before deploying to real hardware.
Q: What is monitoring (Go Online) mode used for?
A: It shows live status of contacts, coils and variables (highlighted ON/OFF) directly on the ladder diagram
while the PLC (real or simulated) is running, which is essential for commissioning and troubleshooting.
Q: What communication interface does the S7-1200 typically use, and how do you identify link status?
A: PROFINET (Ethernet/LAN) via the onboard port (e.g., X1 P1). Onboard LINK and Rx/Tx LEDs indicate
physical connection and active data communication respectively.
Q: What is the difference between digital and analog I/O modules?
A: Digital I/O handles simple ON/OFF (binary) signals from switches, sensors, relay outputs, etc. Analog I/O
handles continuously variable signals (e.g., ±10 VDC or 0–20 mA) representing measured quantities like
temperature, pressure or speed, converted to/from a multi-bit digital value (e.g., 13-bit AI / 14-bit AQ
resolution on the SM 1234 module).
F. Applied / Scenario-based Questions
Q: How would you design logic so a lamp glows only when two specific switches are pressed together,
OR a third switch alone is pressed?
A: (S1 AND S2) in series, placed in parallel with S3 alone, all feeding the same output coil — i.e., an OR of
(AND) and a single contact.
Q: How would you implement a motor-safety interlock (e.g., a bike ignition) where the engine can start
only if the side-stand is up AND the ignition key is ON?
A: Series NO/NC contacts for each safety condition (side-stand NC/NO contact in series with ignition-key
contact) feeding the engine-start output coil — all conditions must be simultaneously satisfied (series = AND
logic) before the output energizes.
Q: How would you design a system where only one lamp is ON at a time out of many, and pressing one
switch turns the previous lamp OFF?
A: Use mutual interlocking: each lamp's coil rung includes the NC contact of the other lamp(s) in series, so
activating one lamp's contact automatically breaks the circuit of the currently active lamp (implemented with
cross-interlocked NC contacts, as in an anti-tie-down or alternator circuit).
Q: How would you implement an emergency-stop feature that overrides normal operation?
A: Wire the emergency-stop switch's NC contact in series with the main enabling rung so that engaging
E-Stop breaks power to all outputs, regardless of any other logic condition being true.
Q: A pump-monitoring system requires at least 2 of 3 pumps running at all times, with an alarm if any
pump fails, and auto-start of the standby pump. How is this designed?
A: Each pump has its own feedback-driven output (M1, M2, M3) confirming run-status. An alarm coil is driven
by an OR-of-ANDs pattern that detects any two-out-of-three feedback bits both being 0 (pump failed), and the
standby pump's rung is enabled when its 'in service' contact plus the failure condition of a running pump is
TRUE, so it auto-starts to maintain 2-of-3 running.
Q: What safety/industrial certifications might you look for on a PLC module, and why do they matter?
A: CE, UL Listing, FM Approval (Class I Div. 2 / Zone 2), IECEx, ATEX — these certify that the module is safe
to install (per relevant standards) including, where marked, suitability for use in or near potentially
hazardous/explosive atmospheres.
G. Quick-Fire Definitions
Term Meaning
Rung One horizontal logic line in a ladder diagram, between the two rails
Contact Ladder symbol representing an input condition (NO / NC)
Coil Ladder symbol representing an output
Scan cycle One complete pass of Read Inputs → Execute Program → Write Outputs
PT Preset Time — the target duration set on a timer block
ET Elapsed Time — the timer's running/current time value
OB1 The default 'Main' organization block where the primary program resides in TIA Portal
I/Q Standard Siemens address prefixes: I = Input, Q = Output
M (memory bit) An internal 'marker' bit used for flags/latching, not tied directly to physical I/O
Tip: When answering PLC interview questions, always relate your answer back to the scan cycle (read →
execute → write) and to series=AND / parallel=OR ladder logic — these two ideas underpin almost every
question above.