Professional Documents
Culture Documents
Ladder Logic Fundamentals PLC Tutorial
Ladder Logic Fundamentals PLC Tutorial
1/14/2008
Topics
PLC programming languages Anatomy of a ladder program Logic functions Logical continuity vs. electrical continuity I/O Mapping Mastering examine on and examine off instructions The PLC scanning process
2
MET 382
1/14/2008
Rung 0
Rung 1
Rung 2
MET 382
1/14/2008
MET 382
1/14/2008
Rung Number
Description assigned to alias tag Alias tag pointing to base address Base address Input Instruction
8
MET 382
1/14/2008
Logic Functions
PLC programming is a logical procedure In a PLC program, things (inputs and rungs) are either TRUE or FALSE If the proper input conditions are TRUE:
The rung becomes TRUE and an output action occurs (for example, a motor turns on)
Exclusive OR
10
MET 382
1/14/2008
Input 1 0 0 1 1
Input 2 0 1 0 1
Output 0 0 0 1
0 1
False True
)
11
Logic Functions - OR
Input 1 Input 2
Input 1 0 0 1 1
OR O Logic
O t t Output
Input 2 0 1 0 1
Output 0 1 1 1
0 1
False True
12
MET 382
1/14/2008
Output
Input 1 0 0 1 1
Input 2 0 1 0 1
Output 0 1 1 0
0 1
False True
13
Three input instructions ANDed together. All 3 input instructions must be true in order to energize the output
14
MET 382
1/14/2008
Three input instructions ORed together. If any of the 3 input instructions are true the output will be energized
15
16
MET 382
1/14/2008
Logical Continuity
Logical continuity in a ladder rung occurs when there is a continuous path of TRUE conditions from the left power rail to the output instruction(s) When there is logical continuity, the rung becomes true and the output becomes energized
17
Rung 1
Rung False F
Rung 2
Rung T R True F T T
MET 382
1/14/2008
When there is electrical continuity, a bit in the PLCs memory (sometimes called the input image table) is set to a 1.
20
10
MET 382
1/14/2008
Electrical Continuity
+24v Normally open (N.O.) pushbutton [shown pushed] COM Input Module
Input Circuitry
21
Electrical Continuity
+
+24v Input Module
COM
Power rail
Power rail
22
11
MET 382
1/14/2008
Ladder Program:
( No Logical Continuity
Electrical Continuity
23
I/O Mapping
Every discrete input is assigned to a specific bit in the PLCs memory (input image table)
If there is electrical continuity, the bit is set to a 1 If there is no electrical continuity, the bit is reset to a 0
Every discrete output is assigned to a specific bit in the PLCs memory (output image table) PLC s
In order for an output to turn on, its associated bit must first be set to a 1
24
12
MET 382
1/14/2008
Note: Bit addresses are given in octal for an Allen-Bradley PLC-5 system The bits are numbered 0 17
10 02 16 14 12 06 04 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05 03 15 11 07 01 17 13
I:XXX/10
Output Module
10 02 16 14 12 06 04 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05 03 15 11 07 01 17 13
PLCPLC-5 Systems
25
I/O Mapping
Output Image Table in RSLogix 5 software Input Image Table in RSLogix 5 software
PLCPLC-5 Systems
26
13
MET 382
1/14/2008
I/O Mapping
Output Image Table in RSLogix 5:
O:005 is a 16 bit word address:
PLCPLC-5 Systems
27
I/O Mapping
Input Image Table in RSLogix 5:
1 word = 16 bits (bits are numbered in octal for a PLC-5)
PLCPLC-5 Systems
28
14
MET 382
1/14/2008
I/O Mapping
ControlLogix tag database:
ControlLogix Systems
29
30
15
MET 382
1/14/2008
31
16
MET 382
1/14/2008
PLCPLC-5 Systems
34
17
MET 382
1/14/2008
Note: The terms Examine on, Examine off, Examine if closed (XIC), and Examine if open (XIO) are unique to Allen-Bradley PLCs.
36
18
MET 382
1/14/2008
True
False
37
19
MET 382
1/14/2008
PLC
Inputs s
(N.O.)
Outpu uts
FAN
Stop
(N.C.)
Mastering Examine On & Examine Off Instructions How the system functions depends on the program:
The inputs could be programmed as two inputs ANDed together:
In either case, the wiring is the same! The PLC program logically connects the input devices to the output actuators through the PLC program!
40
20
MET 382
1/14/2008
0 or 1 The bit representing the push button is: ON (set to a 1) if there is electrical continuity
+24v
Start
(N.C.)
42
21
MET 382
1/14/2008
43
44
22
MET 382
1/14/2008
Copy the status of ALL of the input terminals to the input image table
If an input is active (i.e., there is electrical continuity), the corresponding bit in the input image table will be set to a 1.
46
23
MET 382
1/14/2008
[END]
Update outputs
48
24
MET 382
1/14/2008
Problem corrected, this output is only used once in the entire program
49
50
25
MET 382
1/14/2008
Typical T i l scan ti time d t i l d data includes: The maximum scan time The last scan time
51
Program Mode
When placed in the PROGRAM mode, the processor stops scanning the ladder program and (typically) all the outputs are turned off
Test Mode
The TEST mode is identical to the RUN mode, except all outputs are disabled (held in their off state)
52
26
MET 382
1/14/2008
RUN
When keyswitch is placed in the RUN mode, the controller is switched into the run mode. The PLC programming software cannot change the controllers mode.
PROG (Program)
When keyswitch is placed in the PROG mode, the controller is switched into the program mode. The PLC programming software cannot change the controllers mode.
53
27