0% found this document useful (0 votes)
950 views58 pages

18EIO133T Automation Unit 2

The document discusses various PLC programming languages and concepts. It describes ladder logic (LD), instruction list (IL), sequential function chart (SFC), and structured text programming languages. It also covers the PLC scan process, fundamentals of logic gates, data flow, and an overview of timers, counters, and arithmetic and bitstring operators used in PLC programming.

Uploaded by

Saran S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
950 views58 pages

18EIO133T Automation Unit 2

The document discusses various PLC programming languages and concepts. It describes ladder logic (LD), instruction list (IL), sequential function chart (SFC), and structured text programming languages. It also covers the PLC scan process, fundamentals of logic gates, data flow, and an overview of timers, counters, and arithmetic and bitstring operators used in PLC programming.

Uploaded by

Saran S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 58

PLC Programming Languages

UNIT - 2

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY


PLC Programming Languages
Ladder Diagram (LD)

• It is a symbolic depiction of instructions


arranged in rungs similar to ladder formatted
schematic diagrams.
Power
rail

Rung
Instruction List (IL)
Instruction List (IL)—a low-level, text-based language that uses
mnemonic instructions.
Sequential Functional Chart
It is similar to a flowchart of your process. SFC
programming is designed to accommodate the
programming of more advanced processes.
Structured Text

•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.
Overview of the data flow
• Examine the status of
the input image table
bits.
• Solve the ladder logic
in order to determine
logical continuity.
• Update the
appropriate output
image table bits, if
necessary.
Figure :Overview of the data flow during
• Copy the output
the scan process. image table status to all
of the output terminals.
PLC Scan
• When a PLC executes a
program, it must know—in
real time—when external
devices controlling a
process are changing.
• During each operating
cycle, the processor reads
all the inputs, takes these
values, and energizes or
deenergizes the outputs
according to the user
program.
• This process is known as a
PLC scan cycle.
Fundamentals of logic

Gate logic Electrical circuit

Relay schematic Ladder logic


Gate logic Electrical circuit

Relay schematic Ladder logic


Ex. No.1
There are 3 inputs I0,I1, I2 and one output Q0. Output is
ON when any 2 inputs are ON.
I0 I1 I2 Q0
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0
Ex. No.2
• There are 2 switches I0 and I1 control 3 output lights
Q0(Blue),Q1(Green) and Q2(Red).
• When I0 is pressed Q1 will be ON
• When I1 is pressed Q0 and Q1 will be ON
• When I0 and I1 are pressed Q2 will be ON

I0

I1
I0 I1 Q0 Q1 Q2
1 0 0 1 0
0 1 1 1 0
1 1 0 0 1
Ex. No.3
• There are 4 inputs I0, I1, I2, I3 and 4
outputs Q0, Q1,Q2,Q3.
• When I0 is ON Q0 and Q2 will be ON
• When I1 is ON Q1 and Q2 will be ON
• When I2 is ON Q0,Q1 and Q3 will be ON
• When I3 is ON all the outputs will be OFF
PLC Programming Exercises
Design a PLC ladder diagram to construct an
alarm system which operates as follows
• If one input is ON nothing happens
• If any two inputs are ON, a red light goes ON
• If any three inputs are ON, an alarm sirens sound
• If all four are ON, the fire department is notified
Solution:
No of inputs – 4(A,B,C,D) ; No. of outputs – 3(Red light, Alarm, Fire
dept. signal)
Case 1: If any two inputs are ON, a red light goes ON -
[AB,BC,CD,AC,AD,BD]
Case 2: If any three inputs are ON, an alarm sirens sound – [ABC,
BCD,ACD, ABD]
Case 3: If all four are ON, the fire department is notified
No of inputs – 4(A,B,C,D)

Any TWO Any THREE ALL


A&B A&B&C A&B&C&D
B&C B&C&D
C&D A&C&D
A&C A&B&D
A&D
B&D
Seal-In Circuits
• It is a method of maintaining current flow
after a momentary switch has been
pressed and released.
• Design a PLC program using ladder
diagram for start-stop
In certain process control application a fan is to run only when all of the
following conditions are met
• Input A is OFF
• Input B is ON or input C is ON, or both B &C are ON
• Inputs D &E both are ON
• One or more of inputs F, G, or H is ON
Write Gate logic, equivalent Boolean expression & realize the same
using PLC ladder diagram
Electrical Interlocking Circuits
A technique called interlocking is used to prevent
the contactors from being energized simultaneously or closing
together and causing a short circuit.
• Design a PLC program using ladder diagram for
Forward-reverse-stop with mutual interlocks
Hardwired Logic versus Programmed
Logic
• To develop a ladder logic program for the
given relay logic circuits.
Latching Relays
• 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.
Function Blocks

29
Timers
On-Delay Timer (Ton): When input (IN) goes
high, output (Q) will go high only after the preset
time (PT) has elapsed. When input goes low,
output will also go low immediately.

Q is TRUE when IN is TRUE and ET is equal to PT. Otherwise it is


FALSE.
30
Timers
Off-Delay Timer (Toff): When input (IN) becomes
high, simultaneously output (Q) becomes high.
When input becomes low, output becomes low
after the preset time (PT) is elapsed.

Q is FALSE when IN is FALSE and ET equal PT. Otherwise it is


TRUE.
31
Timers
Pulse Timer (TP): If input (IN) is low, output (Q) is
low. When input goes high, output will remain
high till the preset time (PT) & after that it will be
reset even if input is high.

Q is TRUE if IN is TRUE and ET is less than or equal to PT. Otherwise it


is FALSE.
32
How to use timers in logic :-

33
Counters
UP Counter (CTU):
When input (CU) has the rising edge, counter
value (CV) is incremented by 1. When CV
becomes equal to the preset value (PV) which
is loaded with some initial value except zero,
output (Q) becomes high. Reset is used to reset
the counter value to zero.

34
Counters
Down Counter (CTD):

When input (CD) has the rising edge, counter


value (CV) is decremented by 1. So when the
counter value becomes equal to the preset value
(PV) which is zero, output (Q) becomes high.
Some initial value is given to Load which is been
shifted to CV.

35
Counters
Up-Down Counter (CTUD):
It can act as Up Counter as well as Down
Counter. So it can perform both the functions.

36
How to use counters in logic :-

37
Example:1
For a grinding operation on a metal part, the
coolant flow on a part must be on for an interval
before the grinding process starts. When the
process circuit is turned on, the coolant motor is
turned on. Eight seconds later the grinding
process starts.
Example:2
There are 3 pumps on a processing line which are operated
in a following sequence.
When START button is pressed pump1 should get ON for
20sec. Next pump2 should get ON for 10sec. Next
pump 3 should get ON for 5 sec. All then remain ON until
a STOP button is pressed. Write PLC ladder diagram,
and realize the same.
There are 2 inputs(start and stop)
Inputs : I0 and I1
Outputs: Q0, Q1 and Q2
Example:3

There are 3 pumps on a processing line


which are operated in a following
sequence.
When START button is pressed pump1
should get ON for 20sec. After 20 sec
pump1 off and pump2 should get ON for
10sec. After 10 sec pump 2 off and pump 3
should get ON for 5 sec. After 5 sec all
pumps should get OFF.
Arithmetic Operators
• ADD
Addition of variables of the types: BYTE, WORD,
DWORD, SINT, USINT, INT, REAL
Two TIME variables can also be added together
resulting in another time
(e.g., t#45s + t#50s = t#1m35s)

41
• SUB
Subtraction of one variable from another of the types:
BYTE, WORD, DWORD, SINT, USINT, INT, REAL .
A TIME variable may also be subtracted from another
TIME variable resulting in third TIME type variable. Note
that negative TIME values are undefined.

42
• MUL
Multiplication of variables of the types: BYTE,
WORD, DWORD, SINT, USINT, INT, REAL

43
• DIV
Division of one variable by another of the types:
BYTE, WORD, DWORD, SINT, USINT, INT,
REAL.

44
Bitstring Operators
• AND
Bitwise AND of bit operands. The operands
should be of the type BOOL, BYTE, WORD or
DWORD.

45
• OR
Bitwise OR of bit operands. The operands
should be of the type BOOL, BYTE, WORD or
DWORD.

46
• XOR
Bitwise XOR of bit operands. The operands
should be of the type BOOL, BYTE, WORD or
DWORD.

47
• NOT
Bitwise NOT of a bit operand. The operand
should be of the type BOOL, BYTE, WORD or
DWORD.

48
Comparison Operators
GT-Greater than
A Boolean operator which returns the value TRUE when the value
of the first operand is greater than that of the second. The operands
can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT.

LT - Less than
A Boolean operator that returns the value TRUE when the value of
the first operand is less than that of the second. The operands can
be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT.

49
LE - Less than or equal to
A Boolean operator that returns the value TRUE when the value of
the first operand is less than or equal to that of the second. The
operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT,
INT.

GE-Greater than or equal to


A Boolean operator that returns the value TRUE when the value of the
first operand is greater than or equal to that of the second. The operands
can be BOOL, BYTE, WORD, DWORD, SINT, USINT.

50
EQ-Equal to
A Boolean operator that returns the value TRUE when the operands
are equal. The operands can be BOOL, BYTE, WORD, DWORD,
SINT, USINT, INT.

NE-Not equal to
A Boolean operator that returns that value TRUE when the
operands are not equal. The operands can be BOOL, BYTE,
WORD, DWORD, SINT, USINT, INT.

51
Example:4
Write a PLC program to operate a light
according to the following sequence.
• A momentary push button is pressed to start the
sequence
• The light is switched ON and remains ON for 2 s.
• The light is then switched off and remains off for 2 s. 
• The sequence repeats until stop pushbutton is pressed
Example:5
Write a PLC program to operate a light according
to the following sequence.
• A momentary push button is pressed to start the
sequence
• The light is switched ON and remains ON for 2 s.
• The light is then switched off and remains off for 2 s.
• A counter is incremented by 1 after this sequence.
• The sequence then repeats for a total of 4 counts.
• After the fourth count, the sequence will stop and the
counter will be reset to zero.
Example:6
When Red 1 is ON for 30s, E-W traffic flows. At this instant, Yellow
2 becomes ON for 5s after which Green 2 becomes ON for 25s.
After 30s, when Red 2 is ON for 30s, N-S traffic flows. At this
instant, Yellow 1 becomes ON for 5s after which Green 1 becomes
ON for 25s and this process continues. There is a start button and a
stop button. Draw the ladder logic to implement the above process.
Example:7

Three conveyors feed a main conveyor. The


count from each feeder conveyor is fed into an
input register in the PLC. Construct a PLC
program to obtain the total count of parts on the
main conveyor. Use a timer to update the total
every 15 seconds. Design, construct, and test
PLC circuits for this process
Example:8

In certain process control application o/p is ON if


the count is less than 34 or more than 41.
Implement the same using PLC ladder diagram

An indicating light is to go ON when a count


reaches 23.The light is then go off when a count
of 31 is reached. Design, construct, and test
PLC circuits for this process
Example:9

In certain process control application when


the count reaches 25, a paint spray is to
run for 40 seconds. Design, construct, and
test PLC circuits for this process.
Additional resources

https://www.youtube.com/watch?v=ReTtgzN-Dmc

https://www.youtube.com/watch?v=7VpgURVaspU

https://www.youtube.com/watch?v=htlo_gUMJQg

You might also like