You are on page 1of 21

PLC Programming

Ladder Diagrams

Consider the diagram below showing a circuit for switching an electric


motor on or off. We can redraw this diagram in a different way, using two
vertical lines to represent the input power rails and connecting the rest of
the circuit between them.
Switch
Switch Motor
L L N
Power M Motor
Supply
N

Electrical Circuit Ladder Diagram

The power lines or rails are vertical lines with the horizontal lines like rungs
of a ladder.
1
PLC Programming
• Ladder Programming

In drawing a ladder diagram the following conventions are adopted:

1. Each rung on the ladder defines one operation in the process control.
2. The ladder diagram as read from left to right from top to bottom.
3. Each rung must start with an input/s and must end with an output/s.
4. Electrical devices are shown in their normal condition.
5. A particular device can appear in more than one rung of a ladder.
6. The inputs and outputs are all defined by there addresses.

2
PLC Programming
• Ladder Logic Symbols

Normally open input contacts

Normally closed input contacts

Output device

END The end rung

3
PLC Programming
• Logic Functions
There are many control situations requiring actions to be initiated when certain
combination of conditions is realized. For example a drill machine is only to be
started when work piece is present (interlock).

– AND function INPUTS OUTPUTS

A B Input Output A B
Load
A

B AND 0 0 0
Supply Voltage
0 1 0
1 0 0
Input A Input B Output
1 1 1
I:1/00 I:1/01 O:1/00
4
PLC Programming
• OR function

A INPUTS OUTPUTS

Input Output
B
A
OR
A B
Load B

Supply Voltage
0 0 0
0 1 1
Input A Output
1 0 1
I:1/00
Input B
O:1/00
1 1 1
I:1/01

5
PLC Programming
• NOT function

A
Input Output

A NOT INPUTS OUTPUTS


Load

Supply Voltage A
0 1
Input A Output

1 0
I:1/00 O:1/00

6
PLC Programming
• NAND function INPUTS OUTPUTS

A B Input Output A B
Load
A

B NAND 0 0 1
Supply Voltage
0 1 0
1 0 0
Input A Input B Output
1 1 0
I:1/00 I:1/01 O:1/00

7
PLC Programming
• NOR function

A INPUTS OUTPUTS

Input Output
B
A
NOR
A B
Load B

Supply Voltage
0 0 1
0 1 1
Input A Output
1 0 1
I:1/00
Input B
O:1/00
1 1 0
I:1/01

8
PLC Programming
• XOR function

INPUTS OUTPUTS
Input A Input B Output

A B
O:1/00

0 0 0
Input A Input B
0 1 1
A
NOT 1 0 1
B
AND 1 1 0
OR
AND

NOT 9
PLC Programming
• Latching
There are often situations where it is necessary to hold an output
energized, even when the input ceases.

Input A Input B Output

O:1/00
Output

O:1/00

10
PLC Programming
• Latching example

I:1/00 I:1/01 O:1/00


Motor

O:1/00

O:1/00 O:1/01
Stop Light

O:1/00 O:1/02
Run Light

END

11
PLC Programming
• Instruction Lists
Another PLC programming method, which can be considered to be the entering of a
ladder program using test, is instruction lists. For this, mnemonic codes are used,
each coed corresponding to a ladder element.

Code Description
LD Start a rung with open contact
LDN Start a rung with a closed contact
AND A series element with open contact
ANDN A series element with closed contact
OR A parallel element with open contact
ORN A parallel element with closed contact
ORB Branch parallel elements
ANB Connect branch elements in series
ST An output
12
PLC Programming
• Instruction Lists
Example:

Input A Input B Output

I:1/00 I:1/01 O:1/00

Step Instruction
1 LD I:1/00
2 AND I:1/01
3 ST O:1/00

13
PLC Programming
• Instruction Lists
Exercise: Write the instruction list for the following ladder
diagrams:

(a) I:1/00 O:1/00

I:1/01

I:1/00 O:1/00
(b)

I:1/01

14
PLC Programming
• Instruction Lists
Exercise: Write the instruction list for the following ladder
diagrams:

I:1/00 I:1/01 O:1/00


(c)

O:1/00

I:1/00 I:1/01 O:1/00


(d)

I:1/00 I:1/01

15
PLC Programming
• Function Block Diagrams
Basically types of diagrams used to describe logic systems. A function block
is a program instruction unit which, when executed , yields one or more
output values.

A Q A

Q
B >=1
B

Ladder Diagram Equivalent function block diagram

16
PLC Programming
•Function Block Diagrams

A
A B Q
Q
B &

Ladder Diagram Equivalent function block diagram

17
PLC Programming
•Function Block Diagrams

A B Q

A >=1
Q
Q
&
B

Ladder Diagram Equivalent function block diagram

18
PLC Programming
•Function Block Diagrams
Exercise: Draw the function block diagram for the following ladder
programs:

a) A B C D Q

A B C D G Q
b)

Q E F

19
PLC Programming
Internal Relays

In PLC’s there are elements that are used to hold data, i.e. bits, and behave like
relays, being able to be switched “on” or “off” and switch other devices “on” or
“off”.

Such internal relays do not exist as real world switching devices but are merely
bits in the storage memory that behave in the same way as external relay output
and input.

There are several terms used to describe these elements, i.e. Auxiliary relays,
Flags, Markers, Coils.

20
PLC Programming
Internal Relays

In 1 In 2 IR 1

In 3

IR 1 In 4 Out 1

21

You might also like