Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 19 of 59

Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual: 11 - Timers and Counters

Pages 146 to 155 of 490, from Mini-PLC-2/02, 2/16, 2/17 Processor (cat. no. 1772-LZ, LZP, LX, LXP, LW, LWP) User Manual

The original document is the PDF (2.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1772-LW /LWD, Allen-Bradley 1772-LWP, Allen-Bradley 1772-LX / LXP and Allen-Bradley 1772-LZP

Page 146

Chapter

11

Timers and Counters

Chapter Objectives

This chapter describes two instructions that keep track of timed intervals or counted events: timers counters

Introduction

Timer and counter instructions are output instructions internal to the processor. They provide many of the capabilities available with timing relays and solid state timing/counting devices. Usually conditioned by examine instructions, timers and counters keep track of timed intervals or counted events according to the logic continuity of the rung. You can program up to 488 internal timers and the last timer address is 1677. The number of counters are limited only by the processor’s memory. The last counter address for each is listed below: This Processor

Has This Last Timer/Counter Address:

Mini-PLC-2/02

3477

Mini-PLC-2/16

7477

Mini-PLC-2/17

17077

Each timer or counter instruction has two 3-digit values. Each value requires one word of data table memory. These 3-digit values are: Accumulated Value (AC) Storage begins at word address 030 in 2-slot and 1-slot addressing modes and 050 in 1/2-slot addressing mode. The address of the AC value word is the address of the timer or counter. The AC value always starts at 000. Use status bit 15 of the AC word to control outputs. Function:

Timers number of elapsed timed intervals Counters number of counted events Both upper 4 bits of accumulated word (14-17) are the status bits.

11-1

Page 147

Chapter 11 Timers and Counters

Preset Value (PR) Storage begins at an address 100 words greater than its corresponding AC value. Function:

Timer Instructions

Timers number of elapsed timed intervals Counters number of counted events Both when the accumulated value equals the preset value, AC = PR, a status bit is set and can be examined to turn an output device on or off.

A timer counts the elapsed time-base intervals and stores this count in the accumulated value word. Timers can be anywhere in the data table. The third digit from the right in the address must be an even number. Timer instructions have three time bases: 1.0 second, 0.1 second, or 0.01 second. Two bits in the accumulated value word are status bits: Bit 15 is the timed (done) bit. It is set when the timer has timed out (AC = PR). The setting or resetting depends on the type of timer instruction. Bit 17 is the enable bit. It is set when rung conditions are true and is reset when rung conditions are false. There are four types of timer instructions available: timer on-delay timer off-delay retentive timer on-delay retentive timer reset

Timer On Delay

11-2

The Timer On Delay instruction is programmed as an output instruction. 010

030

00

TON 1.0 PR 150 AC 000

Page 148

Chapter 11 Timers and Counters

When the timer on delay rung condition becomes: True Timer cycle begins. Timer increments its AC value. Bit 15 is set when AC=PR and the timer stops timing. Bit 17 is set. False Accumulated value resets to 000. Bits 15 and 17 are reset. The accumulated value and status bits are also reset when the Mode Select Switch is turned from the PROG position to RUN/PROGRAM or RUN.

Timer Off Delay

The Timer Off Delay instruction is programmed as an output instruction. 010

030

00

TOF 1.0 PR 150 AC 000

When the timer off delay rung condition becomes: True Bit 15 is set. Bit 17 is set. Accumulated value resets to 000. False Timer cycle begins. Timer increments its AC value. Bit 15 resets when the AC=PR and the timer stops timing. Bit 17 is reset. Keystrokes Enter a Timer On or a Timer Off Delay instruction by performing the following steps. 1.

Press either -(TON)- or -(TOF)-.

2.

Enter <address>.

11-3

Page 149

Chapter 11 Timers and Counters

3.

4.

Enter <time base>. For This Time Base:

Press:

1.0

[1] [0]

0.1

[0] [1]

0.01

[0] [0]

Enter <preset value>.

Editing in a Completed Rung Edit the Timer On or Timer Off Delay instruction by performing the following steps.

Retentive Timer On

11-4

1.

Position the cursor over the Timer On or Timer Off Delay instruction you want to change.

2.

Press -(TON)-, -(TOF)-, or any other appropriate instruction type.

3.

Enter <address>.

4.

Enter <time base>.

5.

Enter <preset value>.

The Retentive Timer On accumulates the amount of time that the preconditions of its rung are true. It controls one or more outputs (by means of other rungs) after the total accumulated time is equal to the preset time. Whenever the rung is false, the accumulated time is retained. If the outputs have been energized, they remain on. The accumulated time and energized outputs are retained if power is removed from the processor. A separate rung, containing a retentive timer reset instruction must be programmed in order to reset the accumulated time to zero and turn off the outputs. 010

030

00

RTO 1.0 PR 150 AC 000

Page 150

Chapter 11 Timers and Counters

When the rung condition becomes: True Timer begins counting time-base intervals. Bit 15 is set when AC=PR and the timer stops timing. Bit 17 is set. False Accumulated value is retained. Bit 15 - no action is taken. Bit 17 is reset. Important: The RTO instruction retains its AC value when the: Rung condition turns false. Processor changes to remote/program mode. Power outage occurs and memory backup is maintained.

Retentive Timer Reset

The Retentive Timer Reset instruction resets the accumulated value and timed bit of the retentive timer to zero. This instruction is given the same word address as its corresponding RTO instruction. When the rung conditions go true, the RTR instruction resets the AC value and resets the status bits to zero. 010

030 RTR

00

PR 150 AC 000

When the rung condition becomes: True RTR instruction resets the accumulated value of the RTO instruction. Bits 15 and 17 are reset. False No action is taken.

11-5

Page 151

Chapter 11 Timers and Counters

Keystrokes Enter a Retentive Timer On or a Retentive Timer Reset instruction by performing the following steps. 1.

Press either –(RTO)– or –(RTR)–.

2.

Enter <address>.

Perform steps 3, 4 and 5 for a Retentive Timer On instruction only. 3.

Enter <time base>.

4.

Enter <preset value>.

5.

Enter <accumulated value>.

Editing in a Completed Rung Edit a Retentive Timer On or a Retentive Timer Reset instruction by performing the following steps. 1.

Position the cursor over the Retentive Timer or Retentive Timer Reset you are going to change.

2.

Press -(RTO)-, -(RTR)-, or any other appropriate instruction type key.

3.

Enter <address>.

Important: Do not perform steps 4 and 5 for a Retentive Timer Reset instruction.

11-6

4.

Enter <time base> if appropriate.

5.

Enter <preset value>.

Page 152

Chapter 11 Timers and Counters

Counter Instructions

A counter counts the number of events that occur and stores this count in its accumulated value word. Counters can be located anywhere in the data table. An event is defined as a false-to-true transition. Counter instructions have no time base.. The last counter address for each is listed below: This Processor

Has This Last Timer/Counter Address:

Mini-PLC-2/02

3477

Mini-PLC-2/16

7477

Mini-PLC-2/17

17077

The upper four bits in the accumulated value (AC) word are status bits: This Bit:

Contains This Information:

14

Overflow/underflow bit. It is set when the AC value of the CTU instruction exceeds 999 or when the AC value of the CTD instruction falls below 000.

15

Count complete bit. it is set when the AC value > PR value.

16

Enable bit for CTD instruction. It is set when the rung condition is true.

17

Enable bit for CTU instruction. It is set when the rung condition is true.

There are three types of counter instructions available with the controller: up counter down counter counter reset

Up Counter

An Up Counter instruction increments its accumulated value for each false-to-true transition of the rung condition. The rung condition must go from true to false and back to true before the next count is registered. 010

030 CTU

00

PR 150 AC 000

When the rung condition becomes: True Accumulated value increments by 1. Bit 14 is set if the AC > 999. Bit 15 is set when AC > PR. Incrementing the accumulated value continues after the preset value is reached. Bit 17 is set and stays set until the rung goes false.

11-7

Page 153

Chapter 11 Timers and Counters

False Accumulated value is retained. Bit 14 - no action is taken. Bit 15 - no action is taken. Bit 17 is reset. The Up Counter instruction retains its AC value when: You change the mode to program or remote program. The rung condition turns false. A power outage occurs and memory backup is maintained. Important: Bit 14 of the accumulated value word is set when the accumulated value either overflows or underflows. When a down counter preset is 000, the underflow bit 14 will not be set when the count goes below 0.

Down Counter

The Down Counter instruction subtracts one from its accumulated value for each false to true transition of its rung conditions. A count is only added on a false to true transition, so rung conditions must go from true to false and back to true before the next count is registered. 010

030 CTD

00

When the rung condition becomes: True Accumulated value decrements by 1. Bit 14 is set when AC < 000. Bit 15 is reset when AC < PR; counting continues. Bit 16 is set and stays set until the rung goes false. False Accumulated value is retained. Bit 14 - no action is taken. Bit 15 - no action is taken. Bit 16 is reset. The Down Counter instruction retains its AC value when: You change the mode to program or remote program. The rung condition turns false. A power outage occurs and memory backup is maintained.

11-8

PR 150 AC 000

Page 154

Chapter 11 Timers and Counters

Important: When a down counter preset is 000, the underflow bit 14 will not be set when the count goes below 0 and the count complete bit 15 will not be reset when AC < PR.

Counter Reset

The Counter Reset instruction resets the up counter or down counter instructions accumulated value and status bits to 0. When used alone, the Down Counter’s accumulated value may need to be “reset” in the program to its original value (usually a value other than 000). 010

030 CTR

00

PR 150 AC 000

When the rung condition becomes: True Accumulated value of the specified counter is reset to 000. Status bits (14,15,16,17) are reset. False No action is taken. Keystrokes Enter an Up Counter, Down Counter or Counter Reset instruction by performing the following steps. 1.

Press -(CTU)-, -(CTD)-, or -(CTR)-.

2.

Enter <address>.

Important: Do not perform steps 3 and 4 for a Counter Reset instruction. 3.

Enter <preset value>.

4.

Enter <accumulated value>.

11-9

Page 155

Chapter 11 Timers and Counters

Editing in a Completed Rung You edit an Up Counter, a Down Counter, or a Counter Reset instruction by performing the following steps. 1.

Position the cursor over the Up Counter, Down Counter or Counter Reset you want to change.

2.

Press either -(CTU)-, -(CTD)-, -(CTR)-, or any other appropriate instruction type.

3.

Enter <address>.

Important: Do not perform steps 4 and 5 for a Counter Reset instruction.

11-10

4.

Enter <preset value> if appropriate.

5.

Enter <accumulated value>.