9 -6 T IMERS AND C OUNTERS

9 -6 T IMERS AND C OUNTERS

PLC timers and counters are internal instructions that provide the same functions as hardware timers and counters. They activate or deactivate a device after a time interval has expired or a count has reached a preset value. Timer and counter instructions are generally considered internal outputs. Like relay-type instructions, timer and counter instructions are fundamental to the ladder diagram instruction set.

Timer instructions may have one or more time bases (TB) which they use to time an event. The time base is the resolution, or accuracy, of the timer. For

instance, if a timer must time a 10 second event, the user must choose the number of times the time base must be counted to get to 10 seconds. Therefore, if the timer has a time base of 1 second, then the timer must count ten times before it activates its output. This number of counts is referred to as ticks . The most common time bases are 0.01 sec, 0.1 sec, and 1 sec. Table 9-

3 shows the number of ticks required for a 10 second count, based on different time bases.

N o t e : R e q u i r e d t i m e = ( # o f t i c k s ) ( T i m e b a s e ) Table 9-3. Time bases.

Timers are used in applications to add a specific amount of delay to an output in the program. Applications of PLC timers are innumerable, since they have completely replaced hardware timers in automated control systems. As an example, timers may be used to introduce a 0.01 second delay in a control program. The program may require such a delay because the PLC turns ON its outputs very quickly as compared to the hardwired relay system it is replacing. This small delay will slow down the response of other components so that proper operation occurs.

Counter instructions are used to count events, such as parts passing on a conveyor, the number of times a solenoid is turned ON, etc. Counters, along with timers, must have two values, a preset value and an accumulated value. These values are stored in register or word locations in the data table. The preset value is the target number of ticks or counting numbers that must be achieved before the timer or counter turns its output ON. The accumulated value is the current number of ticks (timer) or counts (counter) that have elapsed during the timer or counter operation. The preset value is stored in a

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9

preset register, while the accumulated value is kept in an accumulated register. Both of these registers are defined during the programming of the instruction. Either the basic ladder format or the block instruction format can be used to implement timers and counters.

E X AM PLE 9 -5

During a machine modernization project, it is found that part of a relay ladder circuit (see Figure 9-41), when translated into a PLC circuit, does not work correctly. This malfunction is due to the fact that in the hardwired circuit, relay CR5, which is driven by device LS4, had enough delay time to synchronize with the rest of the circuit so that the solenoid actuation was correct. Now that it has been implemented in the PLC, CR5 no longer has this delay. The delay needed is estimated at 3 AC cycles (60 Hz) and the time bases available in the PLC are 0.01,

0.1, and 1 sec. Which time base should be used to create the delay and how many ticks must the delay last?

10 TON 100

Preset Register: Reg 1000 = 50 Accumulated Register: Reg 1001 = xx

Time Base:

Timer output 100 is energized 5 seconds after contact 10 closes.

Figure 9-41. Example relay ladder circuit.

S OLU T I ON

The estimated delay of 3 AC cycles translates into 60 Hz (i.e., 60 cycles/sec). So:

Thus, the required delay is 50 msec. Therefore, the only time base small enough to use is 0.01 sec. Using this time base, the timer must count 5 ticks to create the delay.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9