Professional Documents
Culture Documents
PLC
Analog
Tank Input
Module
Digital Output
PLC
Lamp
Digital
Output
Module
Analog Output
OUT
E Supply air
PLC 0 to 10V P
Analog
Output
Module
Pneumatic control valve
LadderDiagram
❑ Primary programming language for PLCs.
❑ Other programming methodsinclude:
➢ Function block diagrams(FBDs)
➢ Structured text (ST)
➢ Instruction List(IL)
➢ Sequential function charts(SFCs)
❑Visual and Graphical language unlike textual high-level, such as C, C++, Java…
❑ Derived form relay logic diagrams
❑ Primitive Logic Operations
❖ OR
❖ AND
❖ NOT
LadderDiagram
Terminologies
❑ Power Rails -Pair ofvertical lines
❑ Rungs -Horizontal lines
❑ Contacts A, B, C, D… arranged on
rungs
❑ Note in PLCLadder Logic: Rungs
Power Rails
Binary InputDevices
Device One/ZeroInterpretation
Timer On/off
Lights On/off
Valves Closed/open
o
Anatomy of LadderDiagram
❑ Input instructions are entered on the left
❑ Output instructions are entered on the right
❑ The power rails simulate the power supply lines
➢ L1and L2 for AC circuits and +24V and ground for DC circuits
❑ Most PLCs allow more than one output per rung
❑ The processor (or “controller”) scans ladder rungs from top-to-bottom
and from left-to-right.
➢ The basic sequence is alteredwhenever jump or subroutine
instructions are executed.
I/O address format for the SLC family of PLCs.
Program Scan
During each program scan cycle, the processor
reads all the inputs, takes these values, and
energizes or de-energizes the outputs according to
the user program.
The time it takes to complete a scan cycle is a
measure of how fast the controller can react to
changes in inputs.
TON
I:2 TIMER ON DELAY EN
Timer T4:0
Time Base 0.1
Preset 50 DN
Accum 0
Timer Attributes
Time Base:
◼ Timers are typically programmed with several different time bases
TON
I:2 TIMER ON DELAY EN
Timer T4:0
Time Base 0.1
Preset 50 DN
Accum 0
Preset Attribute:
◼ Preset value is the number of time increments timer must count
before changing the state of the output
❑ Time Delay = Preset value x Time Base ( refer to previous example)
❑ Preset can be constant or a variable
Block-Type Timer
Example
TON
I:2 TIMER ON DELAY EN
Timer T4:0
Time Base 0.1
Preset 50 DN
Accum 0
Accum Attribute:
◼ [Rockwell] Timers have one input. When the input transits from low
to high, the timer will begin timing (Accum value)
❑ Timers that do not lose their accumulated time when the enable input line
transitions to low again are known as Retentive Timers
❑ Retentive Timers continue to maintain accumulated time and increment
the time when the input line goes to high again
❑ Non-retentive Timers lose the accumulated time whenever the enable
input transitions to low
◼ The accumulated time resets to zero
Timer Block
Numbering System
TON
I:2 TIMER ON DELAY EN
Timer T4:0
Time Base 0.1
Preset 50 DN
Accum 0
TON
I:2 TIMER ON DELAY EN
Timer T4:0
Time Base 0.1
Preset 50 DN
Accum 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bits
EN TT DN Internal Use 0 T4:0
Preset Value 1 T4:0.PRE
Accumulated Value 2 T4:0.ACC
◼ Current status of timer bits (EN, TT and DN) stored in first 16 bits
◼ PRE value is held in the second 16 bit of timer storage
◼ Third 16 bit holds accumulated value of timer
TON Timer
Ladder Diagram
TON
I:2 TIMER OFF DELAY EN
Timer T4:0
Time Base 1.0
Preset 180 DN
3
Accum 0
T4:0
O:5
TT 1
T4:0
O:5
2
DN
◼ When input I:2/3 is true → timer begins to increment the accumulated value of TON Timer
T4:0 in 1 second intervals
◼ The TT bit is used in rung 2 to turn on Output O:5/1, while the timer is timing (ACC <PRE)
◼ The DN bit of timer 4:0 is used in rung 3 to turn an output O:5/2 when the timer is done
timing (ACC = PRE)
❑ Note: the Preset for this timer is 180 → The timer will have to accumulate 180 1-second intervals to time
out
❑ Note: This is a non-retentive timer: If Input I:2/3 goes low before 180 is reached, the accumulated value
is reset to zero
Timer OFF Delay
TOF
Timer OF (TOF) -Delay
Used to turn an output On or OFF after rung has
been off for a desired time
1. TOF starts to accumulate time when the rung becomes false
3. The timer enable bit (EN bit 15) is set when the rung becomes
true. It is reset when the rung becomes false and ACC < PRE or
the DN bit is reset (ACC = PRE)
4. The done bit (DN bit 13) is reset when the ACC value is equal to
the PRE value. The DN bit is set when the rung becomes true
Timer Off Delay
TOF Bits
TT 1
T4:0
This output is energized when the timer is done timing O:5
DN 2
◼ To zero the ACC value, use a reset (RES) instruction in another rung with
the same address as the RTO
◼ Timer
◼ Time base
◼ Preset
◼ Accumulator
TON TOFF RTO
Bit Set When Remains Set Till Set When Remains Set Till Set When Remains Set Till
Timer done Bit (bit 13 or DN) Accumulated value ≥ preset value Rung conditions go false Rung conditions are true Rung conditions go false Accumulated value The appropriate RES
and the accumulated value ≥ preset value Instruction is enabled
≥ preset value
Timer Timing bit (bit 14 or TT) Rung conditions are true and the Rung conditions go false or Rung conditions are false Rung conditions go true Rung conditions are Rung conditions go false
accumulated value < preset when the done bit is set and the accumulated value or when the done bit is true and the or when the done bit is set
value is less than the preset reset accumulated value
value < preset value
Timer enable bit (bit 15 or EN) Rung conditions are true Rung conditions go false Rung conditions are true Rung conditions go false Rung conditions are true Rung conditions go false
Cascading Timers
Addressing C5:0
Memory Storage
Bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Element
CU DN OV Internal Use 0 C5:0
Preset Value 1 C5:0.PRE
Accumulated Value 2 C5:0.ACC
CTU Counter Bits
Bit Set When Remains Set Till
Count-up Overflow bit (bit 12 or OV) Accumulated value wraps around to -32,768 A RES instruction that has same address as the
(from CTU instruction is executed or the count is
+32,767) and continues up from there towards decremented less than or equal to
zero +32,767 with a CTD instruction
Done bit The accumulated value is The accumulated value becomes less than
(bit 13 or DN) => the preset value the preset value
Count-up enable bit (bit 15 or CU) Rung conditions are true Rung conditions go false or a RES instruction
that has the same address as the CTU
instruction is enabled
Count-Up Counter
Ladder Diagram