0% found this document useful (0 votes)
13 views86 pages

Chapter 3 and 4

The document covers the basics of PLC programming, focusing on fundamental logic gates and their applications in decision-making processes. It contrasts hardwired logic with programmed logic, emphasizing the flexibility of programmable control using languages like ladder logic. Additionally, it discusses processor memory organization, program files, and various PLC programming languages, including ladder diagrams and structured text.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views86 pages

Chapter 3 and 4

The document covers the basics of PLC programming, focusing on fundamental logic gates and their applications in decision-making processes. It contrasts hardwired logic with programmed logic, emphasizing the flexibility of programmable control using languages like ladder logic. Additionally, it discusses processor memory organization, program files, and various PLC programming languages, including ladder diagrams and structured text.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 86

UNIVERSITY OF GONDAR

INSTITUTE OF TECHNOLOGY
Department of Electrical Engineering
Course name: Industrial automation (ECEg5201 )
Chapter 3: Basic of PLC Programming
Part I
•Revision to fundamental logic
gates
•Hardwired logic versus
programed logic
Revision to fundamental logic gates
• Many things can be thought of as existing in one of two states.
• These two states can be defined as “high” “low”,
or “on” or “off”, “yes” or “no”, and “1” or “0

• This two-state binary concept, applied to gates, can


be the basis for making decisions.
CON.
• A logic gate is a circuit with several inputs but only one output that is
activated by particular combinations of input conditions.

Logic Gate as Decision Making


CON.
• NOT Gate Application – Example 1

Acts like a normally


closed pushbutton
in series with the
output
CONT…
• Truth table for three input
AND gate

• Symbol of three input


AND gate

• Once again, note that the gate


output is 1 only for the case where
A=B=C=1
• The expression for the output is
X=ABC.
• For a four-input AND gate, the
output is X=ABCD and so on.
CON.
AND Gate Function Application –
Example 1
CON.
AND Gate Function Application – Example 2
CONT…
• Truth table defining the
OR operation for two
inputs • circuit symbol for
a two-input OR gate

• We can therefore say that the


OR operation result will be 1
if any one or more of input
variables is a 1
• The expression Y= A+B is read
as “Y equals A OR B’’
CONT…
• OR Gate Function Application
CON.
• The automotive dome light will be turned on when the passenger door
switch OR the driver door switch is activated .
CONT…
• truth table of NAND gate for two (a) NAND symbol for two input A
input A & B &B

• The AND output goes HIGH only


when all inputs are HIGH,
while the NAND output goes
LOW only when all inputs are
HIGH.
(b) equivalent circuit;
• This same characteristic is true of
NAND gates having more
than two inputs.
CONT…
• Truth table for two inputs (a) NOR symbol for two inputs

• An OR gate output goes HIGH


when any input is HIGH;
the NOR gate output goes
LOW when any input is HIGH.
• This same operation can be
extended to NOR gates with more (b) equivalent circuit
than two inputs.
CONT…
• XOR (exclusive-OR) Function

The output of this gate is


HIGH only when one input
or the other is HIGH, but
not both.
CONT…
• Any combination of control can be expressed in terms of a Boolean
equation
Hard Wired versus Programmed Logic
• The term hardwired logic refers to logic control functions that
are determined by the way devices are electrically interconnected.
• Hardwired logic can be implemented using relays and relay
ladder schematics.
• Relay ladder schematics are universally used and understood
in industry.
CONT…
Typical Boolean Instruction or Statement List
CONT…
CONT…
• Hardwired logic is fixed; it is changeable only by altering the
way
devices are electrically interconnected.
• In contrast, programmable control is based on the basic logic functions,
which are programmable and easily changed.
• The form in which these instructions (combination of logic gates) are
implemented to convey commands to the PLC is called the language.
• The most common PLC language is ladder logic
motor start/ stop circuit ladder logic program:
• The input and output field devices remain the same as those required
for the hardwired circuit.
• A rung is the contact symbolism required to control an output. Each
rung is a combination of input conditions connected from left to
right with the symbol that represents the output at the far right.
CONT…
• The instructions used are the relay equivalent of normally open (NO)
and normally closed (NC) contacts and coils
CONT…
Example 1) on Hard Wired versus Programmed Logic
CONT…
Example 2)
Example 3)
CONT…
Example 4)
CONT…
Example 5)
CONT…
Programming Word Level Logic
Instructions

Selecting Word-Level Logic Instructions


• If you want to know when matching bits in two different words are
both ON use the AND instruction.
• If you want to know when one or both matching bits in two different
words are ON use the OR instruction.
• If you want to know when one or the other bit of matching bits in two
different words is ON use the XOR instruction.
• If youwant to reverse the status of bits in a word
use the NOT instruction.
CONT…
Programmed AND Instruction
CONT…
Programmed OR Instruction
CONT…
Programmed XOR Instruction
•Part II
•Processor Memory Organization
•Program Files and Data Files, Program
Scan
•PLC Programming Languages
Processor Memory Organization
• While the fundamental concepts of PLC programming are common to
all manufacturers, there are differences in memory
organization, I/O addressing, and instruction set.
• The memory of a PLC is organized by data types.
The memory space can be divided into two broad
categories: program and data memory.
• Program files are the part of the processor memory that stores the
user ladder logic program
• It contains the ladder logic that controls the machine operation.
• The data files store the information needed to carry out the user
program.
• This includes information such as the status of input and output
devices, timer and counter values, data storage, and so on.
CONT…
• program and data file organization for the SLC 500 controller
CONT…
System functions (file 0):-
• This file is always included and contains various system-related information
and user-programmed information such as processor type, I/O configuration,
processor file name, and password.
Reserved (file 1)
• This file is reserved by the processor and is not accessible to the user.
Main ladder program (file 2)
• This file is always included and contains user-programmed instructions that
define how the controller is to operate.
Subroutine ladder program (files 3–255)
• These files are user-created and are activated according to subroutine
instructions residing in the main ladder program file.
• A subroutine is a short program that is used by the main program to perform a
specific function.
• Large programs are often broken into subroutine program files, which are
called and executed from the main program.
CONT…
Output (file 0)
• This file stores the state of the output terminals for the controller.
Input (file 1)
• This file stores the status of the input terminals for the controller.
Status (file 2)
• This file stores controller operation information and useful for
troubleshooting
is controller and program operation.
Bit (file 3)
• This file is used for internal relay logic storage.
Timer (file 4)
• This file stores the timer accumulated and preset values and status bits.
Counter (file 5)
• This file stores the counter accumulated and preset values and status bits.
CONT…
Control (file 6)
• This file stores the length, pointer position, and status bit for specific
instructions such as shift registers and sequencers.
Integer (file 7)
• This file is used to store numerical values or bit information.
Reserved (file 8)
• This file is not accessible to the user.
Network communications (file 9)
• This file is used for network communications if installed or used like
files 10–255.
User-defined (files 10–255)
• These files are user defined as bit, timer, counter, control,
and/or
integer data storage.
CONT…
The I/O address format for the SLC family of PLCs

Part 1: I for input, and a colon


to separate the module
type from the slot.
O for output and a colon to
separate the module type
from the slot.
Part 2: The module slot
number and a forward slash
to separate the slot from the
terminal screw.
Part 3: The screw terminal
number.
CONT…
Data file memory organization for an Allen-Bradley PLC-5
controller • All element and bit
addresses in the
output and input
data files are
numbered Octally.

All element and bit


addresses in all
other data files
are numbered
decimally.

• All data types except


floating-point files, are
the
4/19/2019 treated as whole
CONT…
• The status data file contains information about the processor status:
The address S:015 addresses word 15 of the status file.
• The bit data file stores bit status.
• It frequently serves for storage when using internal
outputs,
sequencers, bit-shift instructions, and logical instructions.
The address B3:400 addresses word 400 of the bit file.
• The timer file stores the timer status and timer data.
T4:000-to-T4:999

• The counter file stores the counter status and counter data.
CONT…
• The control file stores the control element’s status and
data. R6:000-to-R6:999

• The integer file stores integer data values, with a range from 232,768
through 32,767.
N7:000-to-N7:999
The address N7:100 addresses word 100 of the integer file.
• The floating-point file element can store values in the range
from
61.1754944e-38 to 63.4028237e138.
The input image table file
• The input image table file is that part of the data memory allocated to
storing the on/off status of connected discrete inputs.
• Connection of an open and closed switch to the input image table file
through the input module:

• Processor continually
reads current input
status and updates
input image table file
Output Table File Operation
• The output image table file is that part of the program memory
allocated to storing the actual on/off status of connected
discrete outputs.
• Connections of pilot lights to the output image table file through the
output module:

• Processor continually
activates or deactivates
output status according
to output image table
file status.
Program Scan
• A single PLC operating cycle consisting of the input scan, program
scan, output scan, and housekeeping duties.

• The time it takes to complete a scan cycle is called the scan cycle time
and indicates how fast the controller can react to changes in inputs.
CONT…
CONT…
• The scan time is a function of the following:
The speed or clock frequency of the microprocessor system
The length of the ladder program
 The type of instructions executed
The actual ladder true/false conditions
• The actual scan time is calculated and stored in the PLC’s memory.
• The scan is normally a continuous and sequential process of reading
the status of inputs, evaluating the control logic, and updating
the outputs.
CONT…
The scan process applied to a simple single rung program:

• If the input device connected to address I:3/6 is closed, the input


module circuitry senses electrical continuity and a 1 (ON) condition
is entered into the input image table bit I:3/6.
• During the program scan, the processor examines bit I:3/6 for a 1
(ON) condition.
CONT…
• In this case, because input I:3/6 is 1, the rung is said to be TRUE or
have logic continuity.
• The processor then sets the output image table bit O:4/7 to 1.
• The processor turns on output O:4/7 during the next I/O scan, and the
output device (light) wired to this terminal becomes energized.
• This process is repeated as long as the processor is in the RUN mode.
• If the input device opens, electrical continuity is lost, and a 0 would be
placed in the input image table. As a result, the rung is said to
be FALSE due to loss of logic continuity.
• The processor would then set the output image table bit O:4/7 to 0,
causing the output device to turn off.
CONT…
• There are two basic scan patterns Horizontal and Vertical that
different PLC manufacturers use to accomplish the scan function.
• Allen-Bradley PLCs use the horizontal scan by rung method.
• In this system, the processor examines input and output
instructions from the first command, top left in the program,
horizontally, rung by rung.
CONT…
• Modicon PLCs use the vertical scan by column method.
• In this system, the processor examines input and output instructions
from the top left command entered in the ladder diagram,
vertically, column by column and page by page.
PLC Programming Languages
• The term PLC programming language refers to the method by which
the user communicates information to the PLC.

Ladder Diagram (LD)


• a graphical depiction of a process with rungs of logic, similar to the
relay ladder logic schemes that were replaced by PLCs.
CONT…
Function Block Diagram (FBD)
• a graphical depiction of process flow using simple and
complex
interconnecting blocks.
Sequential Function Chart (SFC)
• a graphical depiction of interconnecting steps, actions, and transitions.
Instruction List (IL)
• a low-level, text-based language that uses mnemonic instructions.
Structured Text (ST)
• a high-level, text-based language such as BASIC, C, or
PASCAL
specifically developed for industrial control applications.
Function Block Diagram (FBD)
• Functional block diagram programming uses instructions that are
programmed as blocks wired together on screen to accomplish
certain functions.
• Typical types of function blocks include logic, timers, and counters
Sequential Function Chart (SFC)
• Sequential function chart language is similar to a
programming
flowchart
• SFC of your process.
programming is designed to accommodate the programming of
more advanced processes.
• This type of program can be split into steps with multiple operations
happening in parallel branches. The basic elements of a
sequential function chart program are shown.
Structured Text (ST)
• Structured text is a high level text language primarily used to
implement complex procedures that cannot be easily expressed
with graphical languages.
• Structured text uses statements to define what to execute.
Ladder Diagram (LD)
• Ladder diagram language is the most commonly used PLC language
and is designed to mimic relay logic.
• The ladder diagram is popular for those who prefer to define control
actions in terms of relay contacts and coils, and other functions
as block instructions

(a) Hardwired relay control (b) Equivalent ladder diagram (LD)


circuit program

(c) Equivalent instruction List (IL) program


CONT…
• With switch S open:
• coil CR1 is de-energized
• contacts CR1-1 are open
• light R is off
• contacts CR1-2 are closed
• light G is on

• With switch S closed:


• coil CR1 is energized
• contacts CR1-1 are closed
• light R is on
• contacts CR1-2 are open
• light G is off
Relay-Type Instructions
• The ladder diagram language is basically a symbolic set of instructions
used to create the controller program.
• The three fundamental symbols that are used to translate relay control
logic to contact symbolic logic are Examine If Closed (XIC),
Examine If Open (XIO), and Output Energize (OTE).
• Each of these instructions relates to a single bit of PLC memory
that is specified by the instruction’s address.
• The symbol for the Examine If Closed (XIC) instruction is shown in
Figure below.
• The XIC instruction, which is also called the Examine-on instruction,
looks and operates like a normally open relay contact.

Contacts are open when


no current flows through
the coil but close as soon
as the coil is energized.
CONT…
• Examine If Closed (XIC) instruction
CONT…
• The symbol for the Examine If Open (XIO) instruction is shown in Figure
below.
Contacts are closed when
no current flows through
the coil but open as soon
as the coil is energized

• The XIO instruction, which is also called the Examine-off instruction, looks
and operates like a normally closed relay contact.
• This instruction asks the PLC’s processor to examine if the contact is open.
• Where as XIC instruction asks the PLC’s processor to examine if the contact
is closed.
CONT…
• Examine If Open (XIO) instruction
CONT…
• The symbol for the Output Energize (OTE) instruction is shown
in Figure below.
• The OTE instruction looks and operates like a relay coil and
is
associated with a memory bit.
• This instruction signals the PLC to energize (switch on) or de-energize
(switch off ) the output.
Instruction
• This address indicates what PLC input is connected to what
Addressing
input device and what PLC output will drive what output device.
addressing format for an Allen Bradley SLC 500 controller
Branch Instructions
• Branch instructions are used to create parallel paths of input condition
instructions.
• This allows more than one combination of input conditions (OR logic)
to establish logic continuity in a rung.
CONT…

Parallel input
Parallel output
branches
branches.

Parallel output branching with conditions


Nested input and output
branches

• Input and output branches can be nested to avoid


redundant
instructions and to speed up the processor scan time.
• A nested branch starts or ends within another branch.
CONT…
Nested Contact Program
On some PLC models,
the programming of a
nested branch circuit
cannot be done directly.

Reprogrammed to
obtain the required
logic.
CONT…
Limitation of PLC programming
• only one output per rung and the output must be located at the end of
the rung.
• The only limitation on the number of rungs is memory size
• Another limitation to branch circuit programming is that the PLC will
not allow for programming of vertical contacts.
CONT…
• The processor examines the ladder logic rung for logic continuity
from left to right only. The processor never allows for flow from
right to left.

• Contact combination FDBC would be ignored


CONT…
PLC Matrix Limitation Diagram
• A maximum of seven parallel lines and 10 series contacts per rung is
possible.
Internal Control Relay
• Most PLCs have an area of the memory allocated for what are known
as internal storage bits.
• These storage bits are also called internal outputs, internal coils,
internal control relays, or simply internal bits.
• Unlike a discrete output, an internal output does not directly control an
output field device.
• The advantage of using internal outputs is that there are many
situations in which an output instruction is required in a program
but no physical connection to a field device is needed.
• Internal outputs can minimize output module point requirements
whenever practical.
CONT…
• An internal control relay can be used when a program requires more
series contacts than the rung allows.
Programming The XIC Instruction

Hardwired Circuit

User program providing


the same results

• Note both pushbuttons represented by


that XIC This are is normal state the of
symbol.or (NO
NC) because the does matter is that
not matter! What an if
contacts does need
to close to energize the output, then the input
XIC
instruction is used. Since both PB1 and PB2 must close to
energize the PL, the XIC instruction is used for
both
Programming The XIO Instruction

Hardwired Circuit

User program providing


the same results

• When the pushbutton is open in the hardwired circuit, relay coil


CR is de-energized and contacts CR1 close to switch the PL
on. When the pushbutton is closed, relay coil CR is
energized and contacts CR1 open to switch the PL off.
• The pushbutton is represented in the user program by an XIO
instruction. This is because the rung must be true when
the external pushbutton is open, and false when the
pushbutton
cl
is 72
4 /
Operation of The XIC and XIO Instructions
• Summary of status conditions
Entering the Ladder Diagram
• A personal computer is most often used to enter the
ladder diagram.

The computer is adapted


to the particular PLC
model using the relevant
programmable controller
software
CONT…
• Different screens, toolbars and windows dialog boxes are used
to navigate through the Windows environment.
CONT…
• Bit Instructions Tool Bar

• To place an instruction on a rung, click its icon on the toolbar and


simply drag the instruction straight off the toolbar onto the rung
of the ladder.
CONT…
Select Processor Type Screen
• The programming software needs to know what processor is
being used in conjunction with the program.

You simply
scroll down
the list until
you find the
processor you
are using and
select it.
CONT…
• I/O Configuration Screen

The I/O screen


lets you click or
drag-and-drop a
module from an
all inclusive list to
assign it to a slot
in your
configuration.
CONT…
Data File Screen

Data file screens


contain data that
is used in
conjunction with
ladder program
instructions. These
include:
Input
Output
Timer
Counter
Integer
Bit
Programmed Seal-In Circuit
• A seal-in circuit is a method of maintaining current flow
after a momentary switch has been pressed and released
• In these types of circuits, the seal-in contact is usually in parallel
with
the momentary device.

Hardwired
Programmed
CONT…
• Motor seal-in circuit implemented using an Allen-Bradley
Pico controller.
Latching Relay
• Electromagnetic latching relays are designed to hold the relay closed
after power has been removed from the coil.
• Latching relays are used where it is necessary for contacts to stay
open and/or closed even though the coil is energized only
momentarily.

• The latch coil is momentarily

energized to set the latch and

hold the relay in the latched

position.
• The unlatch or release coil is

momentarily energized to
CONT…
• Electromagnetic latching relay circuit

When the ON button is


momentarily actuated, the
latch coil is energized to set
the relay to its latched
position. The relay does not
have to be continuously
energized to hold the
contact closed.
Contact shown with relay
in the unlatched position
Programmed Latching Relay Instruction
Latching Relay Program

• When the ON button is momentarily actuated, the latch rung


becomes true and the latch status bit (10) is set to 1, and so
the output is switched on. This status bit will remain on (1)
when logic continuity of the latch rung is lost. 1
CONT…
• When the unlatch rung becomes true (OFF button actuated),the status
bit (10) is reset back to 0 and so the output is switched off.
• The status bit will remain reset to 0 when the pushbutton is released
and logical continuity of the latch rung is lost.

You might also like