0% found this document useful (0 votes)
5 views

Chapter4

Uploaded by

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

Chapter4

Uploaded by

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

Chapter 4 1

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461)


 Timer Instructions
 Counter Instructions

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 2


 XIC - Examine if Closed
 XIO - Examine if Open
 OTE - Output Energize
 OTL - Output Latch
 OTU- Output Unlatch
 OSR - One-Shot Rising

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 3


 Introduction
Timers are very important in ladder logic programming. Timers gives the precision in time.
Timer on delay starts timing when instruction is true. Timers are used to track time when
instruction are on or off. They could also keep track on a retentive base.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 4


The following parameters are associated with Timer instructions:

 Preset Value (.PRE)


 This specifies the value which the timer must reach before the controller sets the done bit. When the
accumulated value becomes equal to or greater than the preset value, the done (DN) bit is set. You
can use this bit to control an output device.
 Preset and accumulated values for timers range from 0 to +32,767. If a timer preset or accumulated
value is a negative number, a runtime error occurs.

 Accumulator Value (.ACC)


This is the time elapsed since the timer was last reset. When enabled, the timer updates this continually.

 Timebase
The timebase determines the duration of each timebase interval. For Fixed and SLC 5/01 processors, the
timebase is set at 0.01 second.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 5


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 6
The following is a list of timer instructions in SLC 500:
 TON - Timer On Delay
 TOF - Timer Off Delay
 RTO - Retentive Timer

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 7


Symbol

Definition
 Count time base intervals when the instruction is true.

 The Timer On Delay instruction begins to count time base


intervals when rung conditions become true.
 As long as rung conditions remain true, the timer adjust
its accumulated value (ACC) each evaluation until it
reaches the preset value (PRE).

 The accumulated value is reset when rung conditions go


false, regardless of whether the timer has timed out.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 8


Each Timer on Delay is made of a 3-word element.
 Word 1 is the control word

Bit 0-12: Internal Use

Bit 13: Done (DN) this bit is on when the Accumulation value >= Preset Value

Bit 14: Timer Timing (TT) this bit is on when the timer is timing

Bit 15: Enabled (EN), this bit is on when the timer is energized.

 Word 2 stores the preset value. (PRE)

 The programmer specifies this value. When the accumulated time reaches the preset value the controller sets
the done bit. When the accumulated value becomes equal to or greater than the preset value, the done bit is
set. Usually preset value is from 0 - 32,767

 If a timer-preset value is negative an error will occur.

 · Word 3 stores the accumulated value. (ACC)

This is the time elapsed since the timer was last reset. When enabled the timer updates this continually.

Time Base: is the timing update interval.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 9


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 10
 Lets say that we have a conveyor, alarm and 1 limit switch LS-
01. LS-01 is at the beginning of the conveyor. When LS-01 is
ON we want a buzzer to go on for 3 seconds (Security) and
then we want to start the conveyor. When LS-01 is cleared
then we want to stop the conveyor.
 Input / Output
Conveyor O:2.0/0
Alarm O:2.0/1
LS-01 I:1.0/0
 Ladder Logic Solution

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 11


Symbol

Definition
 Counts time base intervals when the instruction is false.

 The Timer Off Delay instruction begins to count time base


intervals when the rung makes a true to false transition.
 As long as rung conditions remain false, the timer
increments its accumulated value (ACC each scans until it
reaches the preset value (PRE).
 The accumulated value is reset when rung conditions go
true regardless of whether the timer has timed out.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 12


Each timer address is made of a 3-word element.
Word 1 is the control word
Bit 0-12: Internal Use
Bit 13: DN- Done
Bit 14: TT - Timer Timing
Bit 15: EN - Timer is enabled
Word 2 stores the preset value. (PRE)
Specifies the value, which the timer must reach before the controller sets the done bit.
When the accumulated value becomes equal to or greater than the preset value, the done bit
is se.
Preset value is from 0 - 32,767
If a timer-preset value is negative an error will occur.
Word 3 stores the accumulated value. (ACC)
This is the time elapsed since the timer was last reset. When enabled the timer updates
this continually.
Time Base: is the timing update interval.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 13


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 14
 Let's say we have in the field an emergency stop.
Once the E-Stop is pressed we want the buzzer to
go on for 5 seconds.
 Input / Output
 E-Stop Push Button I:1.0/0
 Buzzer O:2.0/0

 Ladder Logic Solution( use TOF Timer)

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 15


Symbol

Definition
 Counts time base intervals when the instruction is true and
retains the accumulated value when the instruction goes
false or when power cycle occurs.
 The Retentive Timer instruction is a retentive instruction
that begins to count time base intervals when rung
conditions become true.
 The Retentive Timer instruction retains its accumulated
value when any of the following occurs:
 Rung conditions become false.
 Changing Processor mode from REM run /Test / program mode.
 The processor loses power (provided that battery back up is still
maintained).
 A fault occurs.

Note : To reset the accumulated value in RTO, you must use a


reset instruction (RES) with the same address.
Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 16
Each Retentive Timer is made of a 3-word element.
Word 1 is the control word
Bit 0-12: Internal Use
Bit 13: DN- Done
Bit 14: TT - Timer Timing
Bit 15: EN - Timer is enabled

Word 2 stores the preset value. (PRE)


Specifies the value, which the timer must reach before the controller sets the done bit.
When the accumulated value becomes equal to or greater than the preset value, the done bit
is set.
Preset value is from 0 - 32,767
If a timer-preset value is negative an error will occur.
Word 3 stores the accumulated value. (ACC)
This is the time elapsed since the timer was last reset. When enabled the timer updates
this continually.
Time Base: is the timing update interval.
Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 17
Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 18
 Let's say we to have a timer on a motor that times the time the motor
was on. What we want to do is to run the lubrication pump every 10
minutes the main motor has run, for 5 seconds.
 Input / Output
 Selector I:1.0/0
 Motor O:2.0/0
 Lube Pump O:2:0/1

 Ladder Logic Solution

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 19


 RESET INSTRUCTION
Use a RES instruction to reset a timer or counter.

When the RES instruction is enabled, it resets the Timer On Delay (TON), Retentive
Timer (RTO), Count Up (CTU), or Count Down (CTD) instruction having the same
address as the RES instruction.
 Cascading Timers
If an event requires a longer time-delay than a timer is capable of providing then multiple
timers may be cascaded. That is, one timer completes a timing cycle and then activates
another timer.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 20


 Introduction
Counters are very essential in ladder logic programming. Counters are used to index,
increment or decrement values.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 21


The following parameters are associated with Counter instructions:

Each counter address is made of a 3-word element.


 Word 1 is the control word
 Bit 0-7: Internal Use
 Bit 10: UA - Update accumulation value.
 Bit 11: UN - Underflow bit.
 Bit 12: OV - Overflow bit.
 Bit 13: DN - Done
 Bit 14: CD - Count down is enabled.
 Bit 15: CU - Count up is enabled.

 Word 2 stores the preset value. (PRE)


 Specifies the value, which the counter must reach before the controller sets the done bit. When the accumulator value becomes equal to or
greater than the preset value, the done status bit is set. You can use this bit to control an output device.
 Preset value is from -32,768 to 32,767

 Word 3 stores the accumulated value. (ACC)


 This is the number of times of false to true transitions that have occurred since the counter was last rest.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 22


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 23
The following is a list of counter instructions in SLC 500:
 CTU - Count Up
 CTD - Count Down
 HSC – High Speed Counter

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 24


 The figure below demonstrates how a counter works.

 The count value must remain in the range of -32768 to +32767. If the count value goes above +32767
or below -32768, the counter status overflow (OV) or underflow (UN) bit is set.
 A counter can be reset to zero using the reset (RES) instruction

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 25


Symbol

Definition
 Increments the accumulated value at each false to true transition and retains the accumulated value when the
instruction goes false or when power cycle occurs.
 The CTU is an instruction that counts false to true transition. When this transition happens the accumulated value
is incremented by one count.
 A CTU accumulation is reset by the RES instruction.

 If the accumulation value is over the maximum range then the overflow (OV) bit will be true.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 26


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 27
 Count the number of times a photocell goes from off to on. Once we
reach a count of 10 energize a light. We should also have a push button
to reset the counter.
 Input / Output
 Photocell I:1.0/0
 Light O:2.0/0
 Push Button I:1.0/1

 Ladder Logic Solution

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 28


Symbol

Definition
 Decrements the accumulate value at each false to true transition and retains the accumulated value when the
instruction goes false or when power cycle occurs.
 The CTD is an instruction that counts false to true transition. When this transition happen the accumulated
value is decrements by one count.
 A CTD accumulation is reset by the RES instruction.

 If the accumulation value is below the minimum range then the underflow (UN) bit will be true.

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 29


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 30
 We want to have a count down on a proximity switch signal. Once we
reach a count of 10 we will energize a light. When a push button is
pressed then count will be reset.
 Input / Output
 proximity switch I:1.0/0
 Light O:2.0/0
 Push Button I:1.0/1

 Ladder Logic Solution

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 31


As a car enters the parking garage it triggers an up
counter and increments the accumulator by one count.
As a car leaves the parking garage it triggers a down
counter and decrements the accumulator by one count.
The up and down counters will use the same address.
Since the counters have the same address the
accumulated value is the same for both counters.
Whenever the accumulator value is equal to the preset
value (50 car) the counter output is energized to light
the “Lot Full” sign.
 Input / Output

 Entrance gate Sensor I:1.0/0


 Exit gate Sensor I:1.0/1
 Lot Full Sign O:2.0/0

 Ladder Logic Solution

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 32


Symbol

 Definition

Refer to Datasheet

Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 33


Prepared by Dr. Musa Alyaman Automation and Programmable Logic Controller(0938461) 34

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy