Understanding a Programming Logic Controller (PLC)

PLC stands for Programmable Logic Controllers. They are basically used to control automated systems in industries. They are one of the most advanced and simplest forms of control systems which are now replacing hard-wired logic relays at a large scale.

Programming Logic Controller (PLC)


Before getting into details about PLCs, lets us know 3 reasons why PLCs are being widely used these days

  • They are user friendly and easy to operate
  • They eliminate the need for hard-wired relay logic
  • They are fast
  • It is suitable for automation in industries.
  • Its input and output modules can be extended depending upon the requirements

PLC Architecture:

PLC Internal Architecture
PLC Internal Architecture

A basic PLC system consists of the following sections:

  • Input/ Output Section: The input section or input module consists of devices like sensors, switches, and many other real-world input sources. The input from the sources is connected to the PLC through the input connector rails. The output section or output module can be a motor or a solenoid or a lamp or a heater, whose functioning is controlled by varying the input signals.
  • CPU or Central Processing Unit: It is the brain of the PLC. It can be a hexagonal or an octal microprocessor. It carries out all the processing related to the input signals in order to control the output signals based on the control program.
  • Programming Device: It is the platform where the program or the control logic is written. It can be a handheld device or a laptop or a computer itself.
  • Power Supply: It generally works on a power supply of about 24 V, used to power input and output devices.
  • Memory: The memory is divided into two parts- The data memory and the program memory. The program information or the control logic is stored in the user memory or the program memory from where the CPU fetches the program instructions. The input and output signals and the timer and counter signals are stored in the input and output external image memory respectively.

Working of a PLC

PLC Working Schematic
PLC Working Schematic
Working of PLC
Working of PLC
  • The input sources convert the real-time analog electric signals to suitable digital electric signals and these signals are applied to the PLC through the connector rails.
  • These input signals are stored in the PLC external image memory in locations known as bits. This is done by the CPU
  • The control logic or the program instructions are written onto the programming device through symbols or through mnemonics and stored in the user memory.
  • The CPU fetches these instructions from the user memory and executes the input signals by manipulating, computing, processing them to control the output devices.
  • The execution results are then stored in the external image memory which controls the output drives.
  • The CPU also keeps a check on the output signals and keeps updating the contents of the input image memory according to the changes in the output memory.
  • The CPU also performs internal programming functions like setting and resetting of the timer, checking the user memory.

Programming in PLC

The basic functioning of the PLC relies on the control logic or the programming technique used. Programming can be done using flowcharts or using ladder logic or using statement logics or mnemonics.

Interlinking all these, let us see how we can actually write a program in PLC.

  • Compute the flowchart. A flowchart is the symbolic representation of the instructions. It is the most basic and simplest form of control logic which involves only logic decisions. Different symbols are as given below:

Compute the flowchart

  • Write the Boolean expression for the different logic. Boolean algebra usually involves logic operations like AND, OR, NOT, NAND and NOR. The different symbols are:

+   OR operator
.     AND operator
!     NOT operator.

  • Write the instructions in simple statement forms like below:

IF Input1 AND Input2 Then SET Output1 ELSE SET Output

  • Write the ladder logic program. It is the most important part of PLC programming. Before explaining about ladder logic programming, let us know about few symbols and terminologies

Rung: One step in the ladder is called a rung. In simpler words, the basic statement or one control logic is called a Rung.
Y- Normal Output signals
M – Motor symbol
T – Timer
C – Counter


Basic Logic Functions using Ladder Logic

Basic logic functions using ladder logic

  • Writing Mnemonics: Mnemonics are instructions written in symbolic form. They are also known as Opcode and are used in handheld programming devices. Different Symbols are as given below:

Ldi – Load Inverse
Ld- Load
AND- And the logic
OR- Or logic
ANI – NAND logic
ORI- NOR logic
Out – Output

A Simple PLC Application

So, now that we have had a brief idea about programming in PLC, let’s get into developing one simple application.

Problem: Design a simple line follower robotic system to start a motor when a switch is on and simultaneously switch on the LED.  The sensor on the motor detects any obstacle and another switch is on to indicate the presence of the obstacle and the motor is simultaneously switched off and the buzzer is switched on and LED is off.



Let us first assign our symbols or tags to the inputs and outputs

M – Motor,

A – Input Switch 1,

B- Input Switch 2,

L – LED,

Bu –Buzzer

Now let us design the Flow Chart

Flow Chart
Flow Chart

Next Step is writing the Boolean expressions

M = A. (! B)

L = C. (! B)

Bu = B. (! A.! C)

The next step involves drawing the ladder logic program

Ladder Logic Program
Ladder Logic Program

The final step involves writing the mnemonics to be fed to the handheld device

Ld A ANI Ldi B

Ld C ANI Ldi B

Ld B ANI Ldi A AND Ldi C

So, now that I have demonstrated the basic control function using PLC, do let me know more about the ideas of control designs using PLC.

Photo Credits:

Programmable Logic Controllers by wikimedia

Comments are closed.