0% found this document useful (0 votes)
147 views

PLC Basics

This document provides an overview of programmable logic controllers (PLCs), including: - PLCs are electronic devices that control manufacturing processes and ensure stability and smooth transitions. They read inputs, run user-created programs, and update outputs. - The central processing unit coordinates all activities by executing the program and communicating with external devices. Memory stores the operating system and user programs for ladder logic, timers, and counters. - PLCs have advantages over conventional control panels like reduced wiring and costs, easier troubleshooting and modifications, and faster switching. Their programming involves drawing ladder diagrams, inputting the program, and debugging.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views

PLC Basics

This document provides an overview of programmable logic controllers (PLCs), including: - PLCs are electronic devices that control manufacturing processes and ensure stability and smooth transitions. They read inputs, run user-created programs, and update outputs. - The central processing unit coordinates all activities by executing the program and communicating with external devices. Memory stores the operating system and user programs for ladder logic, timers, and counters. - PLCs have advantages over conventional control panels like reduced wiring and costs, easier troubleshooting and modifications, and faster switching. Their programming involves drawing ladder diagrams, inputting the program, and debugging.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 20

PLC

Basics

Introduction:
This section will consist of information about basic concepts of Programmable
Logic Controllers, advantages of PLCs and their uses in industry. A PLC is a
component of a broader term control system. First we have a look at what is a
control system.

What is a Control System?


In general, a Control system is a collection of electronic devices and equipment
which are in place to insure the stability, accuracy and a smooth transition of a
process or a manufacturing activity. It takes any form and varies in scale of
implementation, from a power plant to a semi conductor machine. As a result of
rapid advancement of technology, complicated control tasks accomplished with a
highly automated control system, which may be in the form of Programmable
Logic controller (PLC) also called Programmable Controller (PC) operator panel,
motors, sensors, switches, solenoid walve etc.

What is Programmable Controller?


A PLC consists of a Central Processing Unit (CPU) containing an application
program and input and output modules, which is directly connected to field I/O
devices. The program controls the PLC so that when an input signal from an input
device turns ON, the appropriate response is made. The response normally
involves turning ON an output signal to some sort of output devices.

Power

Input Interface Central Processing Unit Output interface

Memory

Central Processing Unit


The CPU is a microprocessor that co-ordinates the activities of the PLC system. It
executes the program, processing I/O signals and communicates with external
devices.

Memory
There are various types of memory unit. It is the area that holds operating system
and user memory. The operating system is actually a system software that co-
ordinates the PLC. Ladder program, Timer and counter values are stored in the
user memory. Depending on the user’s need, various types of memory are
available for choice:

• Read-Only Memory (ROM)


ROM is non-volatile memory that can be programmed only once. It is, therefore,
unsuitable. It is least popular as compared to other types of memory.
• Random Access Memory (RAM)
RAM is commonly used memory type for storing the user program and data.
The data in the volatile RAM would normally be lost if power source is
removed. However backing up the RAM with a rechargeable battery solves the
problem.
• Erasable Programmable Read Only Memory
EPROM holds data permanently just like ROM. It doers not require battery
backup. However, exposing it to ultraviolet light can erase its content. A prom
writer is required to reprogram the memory.
• Electrically Erasable Programmable Read Only Memory (EEPROM)
EEPROM combines the access flexibility of RAM and the non-volatility of
EPROM in one. Its contents can be erased and reprogrammed electrically,
however, to a limit number of time.

Scan Time
The process of reading the inputs, executing the program and updating the
outputs is known as scan. The scan time is normally a continuous and sequential
process of reading the status of inputs, evaluating the control logic and updating
outputs. Scan time specification indicates how fast the controller can react to the
field inputs and correctly solve the control logic.

Factors influencing Scan Time


The time required to make a single scan (scan time) varies from 0.1 ms to tens of
ms depending on its CPU processing speed and the length of user program. The
user of remote I/O sub-systems increases the scan time as a result of having to
transmit the I/O updates to remote sub-system. Monitoring of the control
program also adds overhead time to the scan, as the controller’s CPU has to send
the status of coils and contact to CRT other monitoring device.

Disadvantages of Conventional Control Panel


Some of the major points are listed below:
• There is too much wiring work in the panel.
• Modification can be quite difficult
• Troubleshooting is troublesome and a skillful person may be needed
• Power consumption can be too high
• Machine down-time is usually log when a problem occurs in the system
• Drawings are not adapted over the years due to changes. It causes longer
down-time in maintenance and modification.

Advantages of PLC Control Panel


• The wiring of the system usually reduces by 80% compared to conventional
relay control system
• The power consumption is greatly reduced as PLC consume much less power
• PLC self-diagnostic functions enable easy and fast troubleshooting of the
system
• Modification can easily be done without altering most of the wiring
connections
• Spare parts for relays and hardware timers are greatly reduced as compared to
conventional control panel
• The machine cycle time is improved due to very fast switching of PLC
• It costs much less compared to conventional system in situation when the
number of I/Os is very large and functions are complex.
• High reliability of PLCs
• An immediate printout of the PLC program can be done ion minutes.
Therefore, hardcopy of the documentation can easily be maintained.

The Role of Programmable Controllers


In an automated system, the PLC is commonly regarded as the heart of the
control system. With a control application program (stored within PLC memory)
in execution, the PLC constantly monitors the state of the system through the
field input devices’ feedback signal. It will then base on the program logic to
determine the course of action to be carried out at the field output device.
The PLC may be used to control a simple and repetitive task, or a few of them
may be interconnected together with other hast controllers or host computers
through a sort of communication network, in order to integrate the control of a
complex process.

Input devices
Intelligence of an automated system is greatly depending on the ability of a PLC
to read in the signal from various types of automated sensing and manual input
field devices.
Push button, keypad and toggle switches, which form the basic man-machine
interface, are types of manual input devices. On the other hand, for detection of
work piece, monitoring of moving mechanism, check on pressure and or liquid
level and many others, the PLC will have to tap the signal, from the specific
automated sensing devices like proximity switch, limit switch, photoelectric
sensor, and level sensor and so on. Types of input signal to the PLC would be of
ON/OFF logic or analog. These input signals are interfaced to PLC through
various types of PLC input module.

Output Devices
AN automatic system is incomplete and the PLC system is virtually paralyzed
without means of interface to the field output devices. Some of the most
commonly controlled devices are motors, solenoids, relay indicators, buzzers etc.
Through activation of motors and solenoids, the PLC can control from simple
pick and place system to a much complex servo positioning system. These type
of output devices are the mechanism of an auto mated system and so its direct
effect on the system performance.
However, other output devices such as pilot lamp, buzzers and alarms are merely
meant for notifying purpose. Like input signal interfacing, signal from output
devices are interfaced to the PLC through the wide range of PLC output module.

PLC Programming Basics

Basic Procedure
There are several basic steps involved in writing a program.

1. Obtain a list of all I/O devices and the I/O points that have been assigned to
them and prepare a table that shows the I/O bit allocated to each I/O device.
2. If you are using LR bits to link two PCs, prepare sheet showing the used of
these bits.
3. Determine what words are available for work bits and prepare a table in
which you can allocate these as you use them.
4. Also prepare tables of TC numbers and jump numbers so that you can allocate
these as you use them. Remember, the function of a TC number can
be defined only once within the program; jump numbers 01 through 99 can
be used only once each.
5. Draw the ladder diagram.
6. Input the program into the CPU Unit. When using the Programming Console,
this will involve converting the program to mnemonic form.
7. Check the program for syntax errors and correct these.
8. Execute the program to check for execution errors and correct these.
9. After the entire Control System has been installed and is ready for use,
execute the program and fine tune it if required.

Instruction Terminology
There are basically two types of instructions used in ladder-diagram
programming instructions that correspond to the conditions on the ladder
diagram and are used in instruction form only when converting a program to
mnemonic code and instructions that are used on the right side of the ladder
diagram and are executed according to the conditions on the instruction lines
leading to them.Most instructions have at least one or more operands associated
with them. Operands indicate or provide the data on which an instruction is to be
performed. These are sometimes input as the actual numeric values, but are
usually the addresses of data area words or bits that contain the data to be used.
For instance, a MOVE instruction that has IR 000 designated as the source
operand will move the contents of IR 000 to some other location. The other
location is also designated as an operand. A bit whose address is designated as
an operand is called an operand bit; a word whose address is designated as an
operand is called an operand word. If the actual value is entered as a constant, it
is preceded by # to indicate that it is not an address.
Basic Ladder Diagrams
A ladder diagram consists of one line running down the left side with lines
branching off to the right. The line on the left is called the bus bar; the branching
lines, instruction lines or rungs. Along the instruction lines are placed conditions
that lead to other instructions on the right side. The logical combinations of these
conditions determine when and how the instructions at the right are executed. A
ladder diagram is shown below.

As shown in the diagram above, instruction lines can branch apart and they can
join back together. The vertical pairs of lines are called conditions. Conditions
without diagonal lines through them are called normally open conditions and
correspond to a LOAD, AND, or OR instruction. The conditions with diagonal
lines through them are called normally closed conditions and correspond to a
LOAD NOT, AND NOT, or OR NOT instruction. The number above each
condition indicates the operand bit for the instruction. It is the status of the bit
associated with each condition that determines the execution condition for
following instructions. The way the operation of each of the instructions
corresponds to a condition is described below. Before we consider these,
however, there are some basic terms that must be explained.
Note When displaying ladder diagrams with the SSS, a second bus bar will be
shown on the right side of the ladder diagram and will be connected to all
instructions on the right side. This does not change the ladder-diagram program
in any functional sense. No conditions can be placed between the instructions on
the right side and the right bus bar, i.e., all instructions on the right must be
connected directly to the right bus bar.
Basic Terms Normally Open and Normally Closed Conditions
Each condition in a ladder diagram is either ON or OFF depending on the status
of the operand bit that has been assigned to it. A normally open condition is ON
if the operand bit is ON; OFF if the operand bit is OFF. A normally closed
condition is ON if the operand bit is OFF; OFF if the operand bit is ON.
Generally speaking, you use a normally open condition when you want
something to happen when a bit is ON, and a normally closed condition when
you want something to happen when a bit is OFF.

Execution Conditions
In ladder diagram programming, the logical combination of ON and OFF
conditions before an instruction determines the compound condition under which
the instruction is executed. This condition, which is either ON or OFF, is called
the execution condition for the instruction. All instructions other than LOAD
instructions have execution conditions.

Operand Bits
The operands designated for any of the ladder instructions can be any bit in the
IR, SR, HR, AR, LR, or TC areas. This means that the conditions in a ladder
diagram can be determined by I/O bits, flags, work bits, timers/counters, etc.
LOAD and OUTPUT instructions can also use TR area bits, but they do so only
in special applications.

Logic Blocks
The way that conditions correspond to what instructions is determined by the
relationship between the conditions within the instruction lines that connect
them. Any group of conditions that go together to create a logic result is called a
logic block. Although ladder diagrams can be written without actually analyzing
individual logic blocks, understanding logic blocks is necessary for efficient
programming and is essential when programs are to be input in mnemonic code.
Instruction Block
An instruction block consists of all the instructions that are interconnected
across the ladder diagram. One instruction block thus consists of all the
instructions between where you can draw a horizontal line across the ladder
diagram without intersecting any vertical lines and the next place where you can
draw the same type of horizontal line.

Mnemonic Code
The ladder diagram cannot be directly input into the PC via a Programming
Console; the SSS is required. To input from a Programming Console, it is
necessary to convert the ladder diagram to mnemonic code. The mnemonic code
provides exactly the same information as the ladder diagram, but in a form that
can be typed directly into the PC. Actually you can program directly in
mnemonic code, although it in not recommended for beginners or for complex
programs. Also, regardless of the Programming Device used, the program is
stored in memory in mnemonic form, making it important to understand
mnemonic code.
Program Memory Structure
The program is input into addresses in Program Memory. Addresses in Program
Memory are slightly different to those in other memory areas because each
address does not necessarily hold the same amount of data. Rather, each address
holds one instruction and all of the definers and operands (described in more
detail later) required for that instruction. Because some instructions require no
operands, while others require up to three operands, Program Memory addresses
can be from one to four words long.
Program Memory addresses start at 00000 and run until the capacity of Program
Memory has been exhausted. The first word at each address defines the
instruction.
Any definers used by the instruction are also contained in the first word.
Also, if an instruction requires only a single bit operand (with no definer), the bit
operand is also programmed on the same line as the instruction. The rest of the
words required by an instruction contain the operands that specify what data is
to be used. When converting to mnemonic code, all but ladder diagram
instructions are written in the same form, one word to a line, just as they appear
in the ladder diagram symbols. An example of mnemonic code is shown below.
The instructions used in it are described later in the manual.

Address Instruction Operands


00000 LD HR 0001
00001 AND 00001
00002 OR 00002
00003 LD NOT 00100
00004 OR 00101
00005 AND LD
00006 MOV(21)
000
D
0000
M
00007 CMP(20)
D
0000
M
HR 00
00008 AND 25505
00009 OUT 20000
00010 MOV(21)
D
0000
M
D
0500
M
00011 LD 00502
00012 AND 00005
00013 OUT 20001

The address and instruction columns of the mnemonic code table are filled in for
the instruction word only. For all other lines, the left two columns are left blank.
If the instruction requires no definer or bit operand, the operand column is left
blank for first line. It is a good idea to cross through any blank data column
spaces (for all instruction words that do not require data) so that the data column
can be quickly scanned to see if any addresses have been left out.
When programming, addresses are automatically displayed and do not have to be
input unless for some reason a different location is desired for the instruction.
When converting to mnemonic code, it is best to start at Program Memory
address 00000 unless there is a specific reason for starting elsewhere.

Ladder Instructions
The ladder instructions are those instructions that correspond to the conditions
on the ladder diagram. Ladder instructions, either independently or in
combination with the logic block instructions described next, form the execution
conditions upon which the execution of all other instructions are based.

LOAD and LOAD NOT


The first condition that starts any logic block within a ladder diagram
corresponds to a LOAD or LOAD NOT instruction. Each of these instruction
requires one line of mnemonic code. “Instruction” is used as a dummy
instruction in the following examples and could be any of the right-hand
instructions described later in this manual.

Address Instruction Operands


00000 LD 00000
00001 Instruction
00002 LD NOT 00000
00003 Instruction

When this is the only condition on the instruction line, the execution condition
for the instruction at the right is ON when the condition is ON. For the LOAD
instruction (i.e., a normally open condition), the execution condition would be
ON when IR 00000 was ON; for the LOAD NOT instruction (i.e., a normally
closed condition), it would be ON when 00000 was OFF.
AND and AND NOT
When two or more conditions lie in series on the same instruction line, the first
one corresponds to a LOAD or LOAD NOT instruction; and the rest of the
conditions, to AND or AND NOT instructions. The following example shows
three conditions which correspond in order from the left to a LOAD, an AND
NOT, and an AND instruction. Again, each of these instructions requires one
line of mnemonic code.
Address Instruction Operands
00000 LD 00000
00001 AND NOT 00100
00002 AND LR 0000
00003 Instruction

The instruction would have an ON execution condition only when all three
conditions are ON, i.e., when IR 00000 was ON, IR 00100 was OFF, and LR
0000 was ON.
AND instructions in series can be considered individually, with each taking the
logical AND of the execution condition (i.e., the total of all conditions up to that
point) and the status of the AND instruction’s operand bit. If both of these are
ON,
an ON execution condition will be produced for the next instruction. If either is
OFF, the result will also be OFF. The execution condition for the first AND
instruction in a series is the first condition on the instruction line.
Each AND NOT instruction in a series would take the logical AND between its
execution condition and the inverse of its operand bit.

OR and OR NOT
When two or more conditions lie on separate instruction lines running in parallel
and then joining together, the first condition corresponds to a LOAD or LOAD
NOT instruction; the rest of the conditions correspond to OR or OR NOT
instructions.
The following example shows three conditions which correspond in order
from the top to a LOAD NOT, an OR NOT, and an OR instruction. Again, each
of
these instructions requires one line of mnemonic code.

Address Instruction Operands


00000 LD NOT 00000
00001 OR NOT 00100
00002 OR LR 0000
00003 Instruction

The instruction would have an ON execution condition when any one of the
three
conditions was ON, i.e., when IR 00000 was OFF, when IR 00100 was OFF, or
when LR 0000 was ON.
OR and OR NOT instructions can be considered individually, each taking the
logical OR between its execution condition and the status of the OR instruction’s
operand bit. If either one of these were ON, an ON execution condition would be
produced for the next instruction.

Combining AND and OR


Instructions
When AND and OR instructions are combined in more complicated diagrams,
they can sometimes be considered individually, with each instruction performing
a logic operation on the execution condition and the status of the operand bit.
The following is one example. Study this example until you are convinced that
the mnemonic code follows the same logic flow as the ladder diagram.

Address Instruction Operands


00000 LD 00000
00001 AND 00001
00002 OR 00200
00003 AND 00002
00004 AND NOT 00003
00005 Instruction

Here, an AND is taken between the status of IR 00000 and that of IR 00001 to
determine the execution condition for an OR with the status of IR 00200. The
result of this operation determines the execution condition for an AND with the
status of IR 00002, which in turn determines the execution condition for an AND
with the inverse (i.e., and AND NOT) of the status of IR 00003.
In more complicated diagrams, however, it is necessary to consider logic blocks
before an execution condition can be determined for the final instruction, and
that’s where AND LOAD and OR LOAD instructions are used. Before we
consider more complicated diagrams, however, we’ll look at the instructions
required to complete a simple “input-output” program.

OUTPUT and OUTPUT NOT


The simplest way to output the results of combining execution conditions is to
output it directly with the OUTPUT and OUTPUT NOT. These instructions are
used to control the status of the designated operand bit according to the
execution
condition. With the OUTPUT instruction, the operand bit will be turned ON
as long as the execution condition is ON and will be turned OFF as long as the
execution condition is OFF. With the OUTPUT NOT instruction, the operand bit
will be turned ON as long as the execution condition is OFF and turned OFF as
long as the execution condition is ON. These appear as shown below. In
mnemonic code, each of these instructions requires one line.

Address Instruction Operands


00000 LD 00000
00001 OUT 01000

Address Instruction Operands


00000 LD 00001
00001 OUT NOT 01001

In the above examples, IR 01000 will be ON as long as IR 00000 is ON and


IR 01001 will be OFF as long as IR 00001 is ON. Here, IR 00000 and IR 00001
would be input bits and IR 01000 and IR 01001 output bits assigned to the Units
controlled by the PC, i.e., the signals coming in through the input points assigned
IR 00000 and IR 00001 are controlling the output points assigned IR 01000 and
IR 01001, respectively.
The length of time that a bit is ON or OFF can be controlled by combining the
OUTPUT or OUTPUT NOT instruction with Timer instructions.

The END Instruction


The last instruction required to complete a simple program is the END
instruction.
When the CPU Unit scans the program, it executes all instructions up to the
first END instruction before returning to the beginning of the program and
beginning
execution again. Although an END instruction can be placed at any point in
a program, which is sometimes done when debugging, no instructions past the
first END instruction will be executed until it is removed. The number following
the END instruction in the mnemonic code is its function code, which is used
when inputted most instruction into the PC. These are described later. The END
instruction requires no operands and no conditions can be placed on the same
instruction line with it.

Address Instruction Operands


00500 LD 00000
00501 AND NOT 00001
00502 Instruction
00503 END(01) ---

If there is no END instruction anywhere in the program, the program will not be
executed at all. Now you have all of the instructions required to write simple
input-output programs. Before we finish with ladder diagram basic and go onto
inputting the program into the PC, let’s look at logic block instruction (AND
LOAD and OR LOAD), which are sometimes necessary even with simple
diagrams.
EXAMPLE#4
Machine for Packaging (For Mangos Packaging)

Operation Logic Determination:


In this example, a Mango Packing Machine is to be controlled. When the
“START” button is pressed the Process will start. The boxes for packing will
come on a conveyor, when the sensor S2 detects the Box it will stop the Box
Conveyor Motor M1 and the Mango Conveyor motor M2 will start. The
Mangoes on this conveyor will fall into the box and the sensor S1 will count
every Mango falling into the Box. When the preset number (10) of Mangoes fall
into the Box. The Mango Conveyor Motor will stop and again the Box Conveyor
Motor will start and the process will be repeated. When the Stop button is
pressed the process will be stopped.
The Machine can be Started and Stopped from the PT Screen. The number of Set
Value (SV) of Mangos can be set from the Screen using key “F2”. The number
of Boxes packed can be counted and can check their daily production status.
 Logic Flowchart:
S T A R T P R O G R A M

X =2 S T A R T
N O
I FI =2 O N
Y E S

O =0 O N
O =1 O F F

Y =0 B o x C Mo n) 1 v e y e r (
X = 1B o Sr e n s o r
N O
I FI =1 O N

Y E S Y =1 M a n g o e sM ) C 2 o n v e y e r (

O =0 O N
O =1 O N

I 0= O N
I N PC V

Y =1 M a nS g e o s eo sr

I FP =V S V

X =3 S T O PY E S

I FI =3 O N

N O E N D

Input/Output Address Declaration:

Inputs Outputs

Description Address Description Address


Mango Sensor (S1) I0 Box Conveyor (M1) O0

Box Sensor (S2) I1 Mangos Conveyor (M2) O1


Start Button I2
Stop Button I3

 Writing Ladder & Programming the PLC:

After completing wiring of Input/Output, follow the procedure as shown in


the Example # 1 for loading the Ladder Program.
In this program the CNT counter command is used for counting Mangoes &
Boxes and simple LD input & OUT output command are used external
input/output. So read carefully these commands in the Module#5 to
understand its function. An interlocking principle is used so that both motors
shall not work at one time.
EXAMPLE # 5
Tank Filling/Draining Control Operation
(For Water or Chemical)

 Determination of Operational Logic:


In this example, the filling of a water tank is controlled. When the “START”
button is pressed, “V1” valve opens and the water begins to fill the tank. At the
same time the stirrer motor “M” will also start. When the water level in tank is
raised from Lower Level Switch (LLS) and reaches to Upper Level Switch
(ULS), the “V1” will close and motor “M” will stop. At the same time V2 valve
will open and the water drainage will start. When the water level in the tank falls
below the LLS then V2 will stop and the process will be repeated four
times.When the four cycles are completed the “End Light” will switch ON and
the “Buzzer” will be ON for 5 secs. The “Stop” button will stop the process, End
light will switch OFF and the machine will be ready for the next process. The
“Reset” button can reset the whole process to initial position at any time during
the operation.
The End Light & Buzzer indications are shown on the Screen (optional). The number of
process and Buzzer time can be set through the HMI Screen. The buzzer time can be set
from “F0” key and No. of Process from “F1” key of the Screen.
 Input/Output Address Declaration:

INPUT OUTPUT
Address Description Address Description
I0 Start PB1 O0 Motor (M)
I1 Stop PB2 O1 Valve 1 (V1)
I2 Reset PB3 O2 Valve 2 (V2)
I3 Lower Level Switch (LLS) O3 End Light (L)
I4 Upper Level Switch (ULS) O4 Buzzer

 Logic Flowchart:
AFTER FLOW CHART

 Writing of Ladder and Programming the PLC:

Follow the procedure as shown in the Example # 1 for loading the Ladder Program & PT Screen.
In this program the CNT counter, LDF rising edge input, LD input & OUT output command are used.
S =V S e t V a l u e
P =V P r e s e n t V a l u e
S T A R T
X =0 S T A R T
I N PC V

I F
I =0 O N N O
I F
Y E S P =V F V
O = 0M
O =3 L I G H T
O = 1V 1 O , O0 1 Y E S
O N

Y E S O 3O N
I =4 U L S I F
I =4 O N

Y E S O 4O N
O = 0M
O = 1V 1 Y =4 B U Z Z E R
O , 0O 1O N

I F T I M E =
0 2V = 2 5 S E C N O
O 2O N
Y E S

I =3 L L S O 4O F F
I F
O 3O N

I =2 V 2 I 1O N

O 2O N X =1 S T O P

O 3O F F

I 3O N

X =2 R E S E T

E N D

You might also like