DUCTION
~The programmable contr
relay-replacing device, 0
controller was to add
included in your ladder programs by simply programming the tee instructi
Be Jadder rung, rill ice the Allen-Bradley $LC 500 and MicroLogix 1000
= timers and counters. “Aller -Bradley’s PLC 5 timers and counters are almost identical to
491492 PART I-PLCINSTRUCTIONS
SLC 500 timers and counters with the exception of the number of timers or counters al-
lowed per file and the specific data files that can be designated as timer or counter files.
When using a PLC 5, a short review of the PLC 5 Instruction Set Reference Manual will
acquaint you with the differences between the two PLCs.
TIMER INSTRUCTIONS
All PLCs have timer instructions. Even though each manufacturer may represent timers
differently on the ladder diagram, most timers operate in the same manner. A timer consists
of the following parts: timer address, preset value, time base, and accumulated value. Fig-
ure 16-1 illustrates an SLC 500 timer ladder rung from Rockwell Software’s RSLogix 500
Programming Software for programming the SLC 500 and MicroLogix 1000. Notice the
timer instruction name, timer on delay (TON), timer address (4:0), time base (1.0 seconds),
a preset value of 100, and the accumulated value of 0.
IA eet
RR tines on ty en}
j co.
ime base /
‘1746-108, Preset 100<| on}
‘Accum 0¢|
Figure 16-1 SLC 500 on-delay timer.
There are bits associated with the current state of the timer called status bits. The
timer address is the timer’s unique identifier in PLC memory. A timer's preset value is
the length of time for which the timeris to run, while the time base specifies at what rate the
timer will increment. A typical time base could be in seconds, tenths of a second, or hun-
dredths of a second. The time base is also referred to as the timer’s accuracy. The accu-
‘mulated value is the current elapsed time.
The three types of timers are on-delay, off-delay, and retentive. Figure 16-2 describes
the common timer instructions.
SLC 500 TIMERS
SLC 500, Micro os and PLC 5 timers are stored in the ti
section of the PLC’ nory. The default
timer data, Each timer consists of three 16-bit words, called “timer elements.” There can
be many timer files for a single processor file. Any data file greater than file § can he as-
signed as an additional timer file. Figure 16-3 illustrates an RSLogix 500 or RSLogix 5
timer file. The only difference between the SLC 500 and PLC 5s is that the SLC can have
256 timers per timer file where the PLC 5.can have 1,000 timers-perfile.
rer file, file 4, in the data fileCHAPTER 16—TIMER AND COUNTER INSTRUCTIONS 493
On Delay | Program a time delay Use an on-delay timer when an action is to begin’a specified
before instruction time after the input becomes true. As an example, a certain step
becomes true in the manufacturing process is to begin 30 seconds after a
signal is received from a limit switch. The 30-second delay
js the on-delay timer’s preset value.
Off Delay | Program atime delay to | For example, for an external cooling fan on a motor, the fan is to
begin after rung inputs run all the time the motor is running and for five minutes ater
go false the motor is turned off. Ths isa five-minute off-delay timer. The
five-minute timing cycle begins when the motor is turned off.
Retentive | Retain accumulated value | Use a retentive timer to track the running time of a motor for
through power loss, ‘maintenance purposes. Each time the motor is turned oft, the
processor mode change, | timer will remember the motor’s elapsed running time. The
or rung state going from | next time the motor is turned on, the time wil increase from
true to false there. To reset this timer, use a reset instruction,
Reset Reset the accumulated ‘TWpically used to reset a retentive timer’s accumulated value
value of atimer or counter _| to zero.
Figure 16-
2. Timer instructions common to most PLCs.
ta File 14 = TIMER
(HEAT. PART)
(epaNe_rnr)
fe 16-3 SLC 500 oF PLC 5 timer file from RSLogix software.
Separating timers into separate files, and thus grouping them in terms of the fune-
tion they play in the process being controlled, simplifies tracking and troubleshooting.
As an cxample, if all timers associated with manufacturing process A are grouped in
timer file T12, all timers associated with process B are grouped in timer file T13, and494 PART II-PLC INSTRUCTIONS
all timers. associated with process C are grouped into timer file T14, troubleshooting
problems with process B will lead to an examination of the timers in file 13. If all
timers were in the default file, file 4, troubleshooting process B's timer problems could
be quite a challenge. Figure 16-4 shows data files from either RSLogix 5 or RSLogix
500. Notice the default data files, and the newly created data files including 742, T13,
and T14.
BG Propet
SG Heb
8 Controter
‘LB utpontitonitor
(2 Program Files
5. DataFies
‘ {8} Cross Reference
LIB 00-ourpuT
eB) INPUT
A) s2-staTus
| LAB) 63-enary
—[} 14: TIMER | Default data files
DB) cs-counTer
£} R6-CONTROL
| BD N7- INTEGER
| D) Fe-rLoat
EI no-Recres
Dl b10-BITsTORE
D) wi1-PRopucTION.
B Te- Process A
—P) T18-PROCESSB |New timer files
Ej Tia-processo_|
Figure 16-4 RSLogix data table files, including newly created timer files T12, 113,
and T14,
Timer Element
A timer instruction is one element. A timer element is made up of three 16-bit words:
» Word zero contains the three status bits, EN, TT, and DN (status bits will be
covered as we introduce each timer instruction).
» Word one is for the preset value.
» Word two is for the accumulated value.495
CHAPTER 16—TIMER AND COUNTER INSTRUCTIONS
Figure 16-5 illustrates the format of a
Preset Value
Accumulated Value
Figure 16-5 One timer element is made of three 16-bit words.
Timer Addressing
‘Timer addressing is done as follows:
1, To address the timer element, the address format is T4:2.
T identifies this as a timer file.
4= timer file 4, the default. SLC timers can be assigned any unused
file from 9t6 255.
:2 = This is timer two in file 4. There are 256 timers available in each file.
~""Timers 0 throtigh 255 are available.
2. To address timer two's accumulated value, the address used is T4:2.4CC,
T = T identifies this as a timer file.
4 = This is timer file 4, the default.
:2 = This is timer two in file 4.
= The pointis called the word delimiter. The word delimiter separ
timer number, called the structure, from the subelement. The
subelement is ACC, for accumulated value.
3. To address timer two's preset value, the address used is T4:2. PRE.
T = T identifies this as a timer file.
4= This is timer file 4,
2. = This is timer two in file 4.
_ = The point is called the word delimiter. The word delimiter separates the
timer number, called the structure, from the subelement. The
subelement is PRE for preset value.
4, Timers have three status bits. Word zero, bit 13, i the done bit, identified as DN
The done bit is set when the timers accumulated value is equal to the rs
value. Word zero, bit 14, is the timer-timing bit. The timer-timing bit is ic
as TT. This bit is set when the timer is timing.
Word zero, bit 15, is the enable bit, represented as EN. Bit 15 is set wher
the timer is enabled. To address T4:2s status bits, simply place their idenifi496 PART II-PLC INSTRUCTIONS
bit number after the slash identified as the bit delimiter. The proper bit address-
ing format is listed below for timer status bits.
T4:2/DN is the address for timer file 4, timer two's done bit.
‘T4:2/TT is the address for timer file 4, timer two's timer-timing bit.
‘T4:2/EN is the address for timer file 4, timer two's enable bit»
SLC 500 Time Base
SLC 500 timer time bases are listed for each processor. MicroLogix 1000 has a selectable
time base of either .01 second or 1.0 second. For fixed and 5/01 processors, the time base
is 01 second. SLC 5/02, 5/03, and 5/04 processors have selectable time bases of .01, or 1.0
second, MicroLogix 1200 and 1500 have time bases of .001, .01, or 1.0 second.
Timer Accuracy
‘Timer accuracy is related to the timer time base and the processor scan length. When
looking at antigo ing eyele, aéciraey ithe degie® of error between the act ‘
value in the instruction fe representing the Je. An excessive
program scan Gme will disrupt the normal update Trom the processor. SLC 500
timer accuracy is ~0,01 to 0 second, with a program scan of up to 2.5 seconds. As an ex-
ample, a 1-second timer will maintain accuracy with a program scan of 1.5 seconds or
less. For long program scan times, a possible solution to avoid timer inaccuracy is to re-
peat the timer rung in your program. By repeating the timer instruction in another rung
within your ladder program, the timer instruction can be scanned within the limits of the
2.5-second maximum program scan for an SLC 500 PLC. When using other than an SLC
500 PLC, consult your particular specifications to decide the accuracy of timers associ-
ated with that particular PLC.
Now that we have looked at what makes up an SLC 500 timer element, we will inves-
tigate each timer instruction.
THE ON-DELAY TIMER INSTRUCTION
Use the on-delay timer instruction if you want to program a time delay before an instruc-
tion becomes true.
Timer Addressing
‘Timer addressing is as follows: T (Timer file number): (Timer element number). The
timer address T4:0 is addressing timer file 4, timer element 0,
+ The default timer file numberis four
+ Any unused data file greater than 10 and up to and including 255 may be a timer file.
+ Additional timer files may be created in the memory map screen.
» Each timer file may have up to 256 timer elements.CHAPTER 16—TIMER AND COUNTER INSTRUCTIONS
wads
Example; T4:1 = timer file 4, timer element 1 (remember, a timer element is siniply
another name for timer number 1 in timer file 4)
‘T4:12 = timer file 4, timer element 12
‘T4:112 = timer file 4, timer element 112
T16:34 = timer file 16, timer element 34
162 = timer file 16, timer element 2
Figure 16-6 illustrates an on-delay timer, called a timer on delay (TON) for Allen-
Bradley RSLogix software along with the associated ladder rungs.
ra
TON.
Frimer On Dela
000 ime° "ap Len)
merBase 1
Preset 100