Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• Rails
• Rungs
Components of Ladder
001
002
003
Ladder Logic Basics
• Internal relays : are just about the same as Inputs and Outputs
except that they don't point to any hardware. They just hold an ON /
OFF value inside of the PLC's memory.
• Data registers : are used for data like integers and hexadecimal
numbers as their addresses.
Logical Continuity
Each rung of ladder logic generally consists of two components.
• Conditional Instructions
• Output Instructions
If there is a path of true conditional instructions, then the rung goes true
and outputs occur.
• Timer Instructions
• Counter Instructions
• Compare Instructions
• Math Instructions
• PID Instruction
Bit Instructions
Input Instructions:
ON TRUE
15
I:011
OFF FALSE
15
Bit Instructions
Input Instructions:
ON TRUE
15
I:022
OFF FALSE
15
Bit Instructions
Output Instructions:
TRUE ON
15
O:033
FALSE OFF
15
Bit Instructions
Output Instructions:
Bit O:033/15 remains high even after rung is false. OTL can
only turn-on a bit.
O:033 RUNG STATUS BIT STATUS
L
TRUE ON
15
O:033
FALSE NO CHANGE
L
15
Bit Instructions
Output Instructions:
Bit O:033/15 turns OFF when the rung is true. OTU can only
turn-off a bit.
U
TRUE OFF
15
O:033
FALSE NO CHANGE
U
15
Bit Instructions
One Shot Instruction :
Scan – 1 ONS
Scan – 2 ONS
Scan – 3 ONS
Scan - 4 ONS
Logic Gates
Timer instructions
Timer Instruction Structure :
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
T f : s
.PRE • Specifies the value which the timer should reach before the
Preset bit processor sets/resets the .DN bit.
• Range : 0 – 32,767
.ACC • Number of time increments the instruction has counted
Accumulator bit • Counting starts from the value entered in this word.
( Typical value = 0 )
.TT • This bit is set the timer is timing
Timer timing
Time base • 1 Sec : Range = 32767 time base intervals ( 9.1 hours )
• 0.01 Sec : Range = 32767 time base intervals ( 5.5 minutes )
Timer instructions
Timer On Delay ( TON ) :
TON
TIMER ON DELAY EN
Timer
Time base
Preset DN
Accum
Timer instructions
TON – Status Bits :
I:011 TON
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 0
T4:0 O:012
TT 12
T4:0 O:012
DN 13
Timer instructions
TON – Example :
I:011 TON
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 1
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
TON – Example :
I:011 TON
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 2
T4:TT O:012
T4:0 O:012
DN 13
Timer instructions
TON – Example :
I:011 TON
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 3
T4:0 O:012
TT 12
T4:0 O:012
I:011 TON
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 3
T4:0 O:012
TT 12
T4:0 O:012
DN 13
Timer instructions
Timer Off Delay ( TOF ) :
TOF
TIMER ON DELAY EN
Timer
Time base
Preset DN
Accum
Timer instructions
TOF – Status Bits :
I:011 TOF
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 0
T4:0 O:012
TT 12
T4:0 O:012
I:011 TOF
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 1
T4:0 O:012
T4:0 O:012
I:011 TOF
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 2
T4:0 O:012
T4:0 O:012
I:011 TOF
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 3
T4:0 O:012
T4:0 O:012
I:011 TOF
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 3 DN
Accum 0
T4:0 O:012
TT 12
T4:0 O:012
DN 13
Timer instructions
Retentive Timer ( RTO ) :
RTO
TIMER ON DELAY EN
Timer
Time base
Preset DN
Accum
Timer instructions
RTO – Status Bits :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 0
T4:0 O:012
TT 12
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 1
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 2
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 2
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 3
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 4
T4:0 O:012
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 5
T4:0 O:012
TT 12
T4:0 O:012
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Rung is false but DN
Preset 5
ACC is not reset
Accum 5
T4:0 O:012
TT 12
T4:0 O:012
DN 13
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
Accum 5
T4:0 O:012
TT 12
T4:0 O:012
DN 13
I:011 T4:0
RES
13 Timer reset required to reset ACC
Timer instructions
RTO– Example :
I:011 RTO
TIMER ON DELAY EN
12 Timer T4:0
Time base 1.0
Preset 5 DN
ACC reset Accum 0
T4:0 O:012
TT 12
T4:0 O:012
DN 13
I:011 T4:0
RES
13
Counter Instructions
Counter Instruction Structure :
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
C5:0 CU CD DN OV UN
Preset Value ( 16 Bit )
Accumulated Value ( 16 bit )
T f : s
.PRE • Specifies the value which the counter should reach before the
Preset bit processor sets/resets the .DN bit.
• Range : – 32,767 to + 32,767
.ACC • Number of false-true transitions instruction has counted
Accumulator bit
.CU • Bit SET when rung containing count-up instruction is true
Count-up enable
.CD • Bit SET when rung containing count-down instruction is true
Count-down enable
.DN • Bit SET when PRE = ACC
Done bit
.OV • Bit SET when counter has counted above upper limit +32,767
Overflow bit
.UN • Bit SET when counter has counted below lower limit - 32,767
Underflow bit
Counter Instructions
Counter Value Range :
0
-1 1
-32,767 +32,767
UV Set OV Set
Counter Instructions
Count-up ( CTU ) :
Each time rung goes from false – true ACC value increases by 1
CTD
Count Down EN
Counter
Preset
Accum DN
Counter Instructions
CTU Status - Bits :
Rung ACC CD DN
True <PRE 1 0
False <PRE 0 0
True >=PRE 1 1
False >=PRE 0 1
Counter Instructions
Count-down ( CTD ) :
Each time rung goes from false – true ACC value decreases by 1
CTD
Count Down EN
Counter
Preset
Accum DN
Counter Instructions
CTD Status - Bits :
Rung ACC CD DN
True <PRE 1 0
False <PRE 0 0
True >=PRE 1 1
False >=PRE 0 1
Counter Instructions
Counter Reset ( RES ) :
RES
Compare Instructions
Equal To ( EQU ) :
EQU
EQUAL O:012
Source A N7:9
Source B N7:10
12
Compare Instructions
Greater Than Or Equal To ( GEQ ) :
GEQ
GRT
LEQ
LES
LIM
O:012
Limit Test ( CIRC)
Low Limit N7:10
Test N7:11
High Limit N7:12 12
Compute Instructions
Expression
Compute Instructions
Valid CPT Operators:
CPT
I:012
COMPUTE
Destination N7:21
12
Expression
(N7:5 I 5 ) I ( N7:6 )
If input I:012/12 is SET divide value in N7:5 by 5 and divide the result by
value in N7:6. Move the final result to destination address N7:21.
Compute Instructions
Addition ( ADD ):
ADD
I:012
ADD
Source A N7:2
12 Source B N7:3
Destination N7:21
If input I:012/12 is SET add values in N7:2 & N7:3 and store the result in N7:21
Compute Instructions
Subtract ( SUB ):
SUB
I:012
SUBTRACT
Source A N7:2
12 Source B N7:3
Destination N7:21
DIV
I:012
DIVIDE
Source A N7:2
12 Source B N7:3
Destination N7:21
MUL
I:012
MULTIPLY
Source A N7:2
12 Source B N7:3
Destination N7:21
When input condition is true CLR sets all the bits of the destination
word to zero.
CLR
I:012
CLEAR
Destination N7:21
12
Source N7:0
12 Destination N7:21
You can use MVM to copy I/O image, Binary or Integer values.
N7:0 Source 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Mask F0F0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
JMP
Jump (JMP) : When Jump instruction is true it lets processor skip rungs.
LBL
Label (LBL ) : Label instruction is the target of the Jump instruction that
has same label number. LBL should be the first instruction
on the rung.
Program Flow
Instructions
Always False (AFI) :
The AFI instruction is a input instruction that is used to make a rung false
when inserted in the condition side of the rung.
AFI
Block Transfer
Instructions
Block-transfer instructions are used to transfer upto 64 words of data
to/from a block transfer module in a local/remote I/O chassis.
• Block-transfer Write (BTW) : is used when you want to transfer data to the
block-transfer module. When the rung goes true the instruction tells the
processor to write data in the the data file specified to the specified
rack/group/module address
• Block-transfer Read (BTR) : is used when you want to receive data from the
block-transfer module. When the rung goes true the instruction tells the
processor to read data from the rack/group/module address and store it
in the data file
Block Transfer
Instructions
BTW and BTR Structure:
BTW