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

The text of a manual · part 11 of 39

Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual: Chapter 5 - Timers and Counter, pages 90 to 97

Pages 90 to 97 of 337, from Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual

The original document is the PDF (4.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 GE Fanuc IC692CPU211D / IC692MDR541C, Fanuc IC692CPU211D / IC692MDR541C, GE IC692CPU211D / IC692MDR541C and GE Fanuc IC693CPU311X

Page 90

Chapter

Timers and Counters

5 This chapter explains how to use on-delay and stopwatch-type timers, up counters, and down counters. The data associated with these functions is retentive through power cycles. Abbreviation

Function

Page

ONDTR

Retentive On-Delay Timer

5-3

TMR OFDT UPCTR DNCTR

Simple On-Delay Timer Off-Delay Timer Up Counter Down Counter

5-5 5-8 5-11 5-13

Function Block Data Required for Timers and Counters Each timer or counter uses three words (registers) of %R memory to store the following information: current value (CV)

word 1 preset value (PV)

word 2 control word word 3

When you enter a timer or counter, you must enter a beginning address (the address for word 1) for this three-word block directly below the graphic representing the function. In the following example, this beginning address is %R00100. Enable

ONDTR 0.10s

Reset

R

Preset Value

PV

Q

%R00100

Note Make sure that the addresses in the three-word block are not used elsewhere in your program (this duplicate use is called “overlapping”). Logicmaster does not check or warn you if register blocks overlap. Timers and counters will not work correctly if you overlap their three-word blocks.

GFK-0467M

5-1

Page 91

5 The control word (the third word in the three-word block) stores the state of the Boolean inputs and outputs of its associated function block, as shown in the following format: 15 14 13 12 11 10

9

7

8

6

5

4

3

2

1

0

Reserved

Reset input Enable input, previous execution

Reserved

Q (counter/timer status output) EN (enable input)

Bits 0 through 11 are reserved by the PLC for use in maintaining timer accuracy; these bits (0 through 11) are not used for counter function blocks.

Note Use care if you use the same address for the function’s PV (Preset Value) input parameter as the second word in the three-word block. If PV is not a constant, the PV input normally is addressed to a different memory location than the second word. Some programmers choose to use the second word address for the PV input, such as using %R0102 when the three-word block starts at %R0101. This allows an application to change the PV while the timer or counter is running. Applications can read the first (CV) or third (Control) words, but the application cannot write to these values, because if they were written to, the function would not work.

Special Note on Certain Bit Operations When using the Bit Test, Bit Set, Bit Clear or Bit Position function, the bits are numbered 1 through 16, NOT 0 through 15 as shown above.

5-2

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 92

5

ONDTR A retentive on-delay timer (ONDTR) increments while it receives power flow and holds its value when power flow stops. Time may be counted in tenths of a second (the default selection), hundredths of a second, or thousandths of a second. The range is 0 to +32,767 time units; therefore, the timing range is 0.001 to 3,276.7 seconds. The state of this timer is retentive on power failure; no automatic initialization occurs at power-up. When the ONDTR first receives power flow, it starts accumulating time (current value). When this timer is encountered in the ladder logic, its current value is updated.

Note If multiple occurrences of the same timer with the same reference address are enabled during a CPU sweep, the current values of the timers will be the same. When the current value equals or exceeds the preset value PV, output Q is energized. As long as the timer continues to receive power flow, it continues accumulating until the maximum value is reached. Once the maximum value is reached, it is retained and output Q remains energized regardless of the state of the enable input. a42931 ENABLE RESET Q A

B

C

D

E

F G

H

A =

ENABLE goes high; timer starts accumulating.

B =

CV reaches PV; Q goes high.

C =

RESET goes high; Q goes low, accumulated time is reset.

D =

RESET goes low; timer then starts accumulating again.

E =

ENABLE goes low; timer stops accumulating. Accumulated time stays the same.

F

ENABLE goes high again; timer continues accumulating time.

=

G =

CV becomes equal to PV; Q goes high. Timer continues to accumulate time until ENABLE goes low, RESET goes high, or CV becomes equal to the maximum time.

H =

ENABLE goes low; timer stops accumulating time.

When power flow to the timer stops, the current value stops incrementing and is retained. Output Q, if energized, will remain energized. When the function receives power flow again, the current value again increments, beginning at the retained value. When reset R receives power flow, the current value is set back to zero and output Q is de-energized. On 35x, 36x, and 37x series PLCs, if the enable to the ONDTR is low, PV = 0 and reset R receives power-flow, then the output will be low. However, on the 311–341 PLCs, under these same conditions, the output will be high.

GFK-0467M

Chapter 5 Timers and Counters

5-3

Page 93

5 Enable

Q

ONDTR 0.10s

Reset

R

Preset Value

PV

Time Base

Address of Three-Word Block

Parameters Parameter Address of Three-Word Block

Description The ONDTR uses three consecutive words (registers) of %R memory to store the following: •

Current value (CV) = word 1.

•

Preset value (PV)

= word 2.

•

Control word

= word 3.

When you enter an ONDTR, you must enter an address for the location of the first of three consecutive words (registers) directly below the graphic representing the function (the use of the other two words is implied). Caution: Do not write to these three words with other instructions. Overlapping these references will result in erratic operation of the timer. Enable

When enable receives power flow, the timer begins functioning.

R

Reset input. When R receives power flow, it resets the current value to zero. Input R, if used, must be connected by one or more contacts to the power rail. This requires that the ONDTR instruction be placed in the first position (left-most position) in the rung.

PV

Preset Value input. PV is the value to copy into the timer’s preset value when the timer is enabled or reset. The timer will turn on the Q output when it times to the PV value.

Q

Output Q is energized when the current value (CV) is greater than or equal to the preset value (PV).

Time Base

This parameter may be programmed for time increment of tenths (0.1), hundredths (0.01), or thousandths (0.001) of seconds. This time base value is multiplied by the number in the Preset Value (PV) input parameter to determine the actual preset value.

Valid Memory Types Parameter flow

%I

%Q

%M

%T

%S

%G address •

R

•

PV

5-4

%AI %AQ const none

• enable

Q

%R

•

•

•

•

•

•

•

•

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

•

•

• •

GFK-0467M

Page 94

5 •

Valid reference or place where power may flow through the function.

Example In the following example, a retentive on-delay timer is used to produce an output (%Q0011) that turns on 8.0 seconds after %Q0010 turns on, and turns off when %Q0010 turns off. This is because when %Q0010 turns off, its normally closed contact passes power to the reset (R) input. The 8.0 second time value is obtained by multiplying the PV value (80) times the time base value (0.1s). | _____ | %Q0010 | | %Q0011 | - - | | - - - |ONDTR| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - | | 0.1s| | %Q0010 | | | - - |/| - - - |R | | | | | | | | CONST, |PV | | +00080 |_____| | | %R0004

TMR The simple on-delay timer (TMR) function increments while it receives power flow and resets to zero when power flow stops. Time may be counted in tenths of a second (the default selection), hundredths of a second, or thousandths of a second. The range is 0 to +32,767 time units, therefore the timing range is 0.001 to 3,276.7 seconds. The state of this timer is retentive on power failure; no automatic initialization occurs at power-up. When the TMR receives power flow, the timer starts accumulating time (current value). The current value is updated when it is encountered in the logic to reflect the total elapsed time the timer has been enabled since it was last reset.

Note If multiple occurrences of the same timer with the same reference address are enabled during a CPU sweep, the current values of the timers will be the same. The timer’s elapsed time value (CV - current value) continues to accumulate as long as the enabling logic remains ON. When the current value (CV) equals or exceeds the preset value (PV), the function begins passing power flow to the right. The timer continues accumulating time until the maximum value (32,767 time units) is reached. When the enabling input transitions from ON to OFF, the timer stops accumulating time and the current value is reset to zero. a42933 ENABLE Q A

A B

GFK-0467M

=

B

C

D

E

= ENABLE goes high; timer begins accumulating time. Current value reaches preset value PV; Q goes high, and timer continues accumulating time.

Chapter 5 Timers and Counters

5-5

Page 95

5 C

= D

E

=

ENABLE goes low; Q goes low; timer stops accumulating time and current time is cleared. = ENABLE goes high; timer starts accumulating time. ENABLE goes low before current value reaches preset value PV; Q remains low; timer stops accumulating time and is cleared to zero. Enable

Q

TMR 0.10s

Time Base PV

Preset Value

Address of Three-Word Block

Parameters Parameter

Description

Address of Three-Word Block

The TMR uses three consecutive words (registers) of %R memory to store the following: •

Current value (CV) = word 1.

•

Preset value (PV)

= word 2.

•

Control word

= word 3.

When you enter an ONDTR, you must enter an address for the location of the first of three consecutive words (registers) directly below the graphic representing the function (the use of the other two words is implied). Caution: Do not write to these three words with other instructions. Overlapping these references will result in erratic operation of the timer. Enable

When enable receives power flow, the timer begins functioning. When the enable input goes off, the current value is reset to zero and Q is turned off.

PV

Preset Value input. PV is the value to copy into the timer’s preset value when the timer is enabled or reset. The timer will turn on the Q output when it times to the PV value.

Q

Output Q is energized when the current value (CV) is greater than or equal to the preset value (PV).

Time Base

This parameter may be programmed for time increment of tenths (0.1), hundredths (0.01), or thousandths (0.001) of seconds. This time base value is multiplied by the number in the Preset Value (PV) input parameter to determine the actual preset value.

Valid Memory Types Parameter flow

%I

%Q

%M

%T

%S

%G address enable Q

5-6

%AI %AQ const none

• •

PV •

%R

•

•

•

•

•

•

•

•

•

•

• •

Valid reference or place where power may flow through the function.

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 96

5

Example In the following example, a TMR timer is used to control the length of time that coil DWELL is on. The timing process starts when the normally open (momentary) contact DO_DWL turns on, which turns on coil DWELL. A DWELL contact keeps coil DWELL energized (“latched”) when contact DO_DWL opens; also, another DWELL contact enables the timer. When the timer reaches its preset value of one-half second, coil REL energizes. The normally closed REL contact opens, interrupting the latched-on condition of coil DWELL, which turns off. The DWELL contact on the timer’s enable input opens, which interrupts power flow to the timer, resets its current value, and de-energizes coil REL. The circuit is then ready for another activation of contact DO_DWL. | | DO_DWL REL DWELL | - - | | - - + - - |/| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - | | | DWELL | | - - | | - - + | _____ | DWELL | | REL | - - | | - - - | TMR | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - | | 0.1s| | | | | CONST, |PV | | +00005 |_____| | | TMRID

GFK-0467M

Chapter 5 Timers and Counters

5-7

Page 97

5

OFDT The off-delay timer’s (OFDT) accumulated value increments while power flow is off, and resets to zero when power flow is on. Time may be counted in tenths of a second (the default selection), hundredths of a second, or thousandths of a second. The range is 0 to +32,767 time units, which gives a range of .001 to 3,276.7 seconds. The state of this timer is retentive on power failure; no automatic initialization occurs at power-up. When the OFDT first receives power flow, it passes power to the right, and the current value (CV) is set to zero. (The OFDT uses word 1 [register] as its CV storage location - see the “Parameters” section on the next page for additional information.) The output remains on as long as the function receives power flow. If the function stops receiving power flow from the left, its output remains on temporarily, and the timer starts accumulating time in the current value; once the accumulated value reaches the preset value, the output turns off.

Note If multiple occurrences of the same timer with the same reference address are enabled during a CPU sweep, the current values of the timers will be the same. The OFDT does not pass power flow if the preset value is zero or negative. Each time the function is invoked by turning off the enabling logic (at the enable input), the current value is updated to reflect the elapsed time since the timer was turned off. When the current value (CV) is equal to the preset value (PV), the function stops passing power flow to the right. When that occurs, the timer stops accumulating time - see Part C below. When the function receives power flow again, the current value resets to zero. a42932 ENABLE Q A

A B C D E F G H

5-8

B

C

D

E

F G

H

= ENABLE and Q both go high ; timer is reset (CV = 0). = ENABLE goes low; timer starts accumulating time. = CV value equals PV value; Q goes low, and timer stops accumulating time. = ENABLE goes high; timer is reset (CV = 0), Q goes high. = ENABLE goes low; timer starts accumulating time, Q stays high. = ENABLE goes high; timer is reset (CV = 0), Q stays high. = ENABLE goes low; timer starts accumulating time, Q stays high. = CV value equals PV value; Q goes low, and timer stops accumulating time.

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M