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

The text of a manual · part 12 of 39

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

Pages 98 to 105 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 98

5

Enable

Q

OFDT 0.10s

Time Base Preset Value

PV Address of Three-Word Block

When the OFDT is used in a program block that is not called every sweep, the timer accumulates time between calls to the program block unless it is reset. This means that it functions like a timer operating in a program with a much slower sweep than the timer in the main program block. For program blocks that are inactive for a long time, the timer should be programmed to allow for this catch-up feature. For example, if a timer in a program block is reset and the program block is not called (is inactive) for four minutes, when the program block is called, four minutes of time will already have accumulated. This time is applied to the timer when enabled, unless the timer is first reset.

Parameters Parameter Address of Three-Word Block

Description The OFDT timer 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 OFDT, 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.

GFK-0467M

Enable

While the enable input is on, output Q stays on, and the current value (CV) is held to zero. When the enable input turns off, the timer begins timing. When the current value (CV) reaches the preset value (PV), the timer stops timing, and Q turns 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 off the Q output when it times to the PV value.

Q

Output Q is energized (1) when the enable input is on and (2) while the current value (CV) is less than the preset value (PV) after the enable input turns off.

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.

Chapter 5 Timers and Counters

5-9

Page 99

5

Valid Memory Types Parameter flow

%I %Q %M %T

%S

%G %R address

•

%AI

%AQ const none

•

•

•

•

• enable

•

PV

•

Q

•

•

•

•

•

•

•

•

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

Examples In the following example, an OFDT timer turns on output coil %Q0001 whenever contact %I0001 is closed. After %I0001 opens, %Q0001 stays on for 2 seconds then turns off. %Q0001

%I0001 OFDT 0.10s

CONST +00020

PV

%R0019

In the next example, the output action is reversed by the use of a negated output coil. In this circuit, an OFDT timer turns off negated output coil %Q0001 whenever contact %I0001 is closed. After %I0001 opens, %Q0001 stays off for 2 seconds then turns on. %Q0001

%I0001 OFDT 0.10s

CONST +00020

PV

%R0019

5-10

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

GFK-0467M

Page 100

5

UPCTR The Up Counter (UPCTR) function is used to count up to a designated value. The range is 0 to +32,767 counts. When the up counter reset is ON, the current value of the counter is reset to 0. Each time the enable input transitions from OFF to ON, the current value is incremented by 1. The current value can be incremented past the preset value PV. The output is ON whenever the current value is greater than or equal to the preset value. The state of the UPCTR is retentive on power failure; no automatic initialization occurs at powerup. Enable

UPCTR

Reset

R

Preset Value

PV

Q

Address of Three-Word Block

Parameters Parameter Address of Three-Word Block

Description The UPCTR Up Counter 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 a UPCTR, 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.

GFK-0467M

Enable

On each positive transition (off to on) of the enable input, the current count value (CV) is incremented by one.

PV

Preset Value input. PV is the value copied into the counter’s preset value when the counter is enabled or reset. The counter will turn on the Q output when it counts up to the PV value. If the preset value is a constant, it must be a positive number between 0 and 32,767.

Q

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

R

Reset Input. When the R input turns on, the current count value (CV) is reset to zero.

Chapter 5 Timers and Counters

5-11

Page 101

5 Valid Memory Types Parameter flow address enable R

• •

PV Q

•

•

%I

%Q

%M

%T

%S

%G

%R

%AI %AQ const none

•

•

•

•

•

•

•

•

•

•

• •

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

Examples Basic Counter Circuit In the following example, the UPCTR will increment its current count value (CV) by one each time %I0001 transitions from off to on. The PV input sets the preset value to 100 counts. When the counter counts to 100, coil %Q0001 will be turned on. The counter will continue to count %I0001 transitions beyond its preset value (of 100) until it either reaches its maximum count value (32, 767), or until %I0020 closes and resets the counter. %Q0001 will be on anytime the CV value is equal to or greater than the PV value. %Q0001

%I0001 UPCTR

%I0020 R

CONST +00100

PV

%R0019

Self-Resetting Counter Circuit In the next example, every time input %I0012 transitions from OFF to ON, the UPCTR counter counts up by 1. Coil %M0001 is energized whenever 100 %I0012 transitions have been counted. Once %M0001 turns ON, the accumulated count is reset to zero by the %M0001 contact on the R input, and %M0001 will turn off. %M0001

%I0012 UPCTR

%M0001 R

CONST +00100

PV

%R0019

5-12

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

GFK-0467M

Page 102

5

DNCTR The Down Counter (DNCTR) function is used to count down from a preset value. The minimum preset value is zero; the maximum present value is +32,767 counts. The minimum current value is –32,768. When reset, the current value of the counter is set to the preset value PV. When the enable input transitions from OFF to ON, the current value is decremented by one. The output is ON whenever the current value is less than or equal to zero. The current value of the DNCTR is retentive on power failure; no automatic initialization occurs at power-up. Enable

DNCTR

Reset

R

Preset Value

PV

Q

Address of Three-Word Block

Parameters Parameter

Description

Address of Three-Word Block

The DNCTR Down Counter 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 a DNCTR, 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 counter.

GFK-0467M

Enable

On each positive transition (off to on) of the enable input, the current count value (CV) is decremented by one.

PV

Preset Value input. PV is the value copied into the counter’s preset value (PV) and current value (CV) registers when the counter is enabled or reset. The counter will turn on the Q output when it counts down from the current value to zero.

Q

Output Q is energized when the current count value (CV) is less than or equal to zero.

R

Reset Input. When the R input turns on, the current count value (CV) is reset to the preset value (PV, and output Q is turned off.

Chapter 5 Timers and Counters

5-13

Page 103

5 Valid Memory Types Parameter flow

%I

%Q

%M

%T

%S

%G address enable

•

R

•

Q

%AI %AQ const none

•

•

•

PV •

%R

•

•

•

•

•

•

•

•

•

•

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

Examples In the following example, the down counter identified as COUNTP counts 5000 new parts before energizing output %Q0005. | _____ |NEW_PRT | | %Q0005 | - - | | - - >DNCTR| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - | | | |NXT_BAT | | | - - | | - - - |R | | | | | | | | CONST, |PV | | +05000 | | | |_____| | COUNTP |

5-14

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

GFK-0467M

Page 104

5

Inventory Count Examples In the next example, the PLC is used to keep track of the number of parts contained in a temporary storage area. There are two ways of accomplishing this function using the Series 90-30/20/Micro instruction set. The first method is to use an up/down counter pair with a shared register for the accumulated or current value. When the parts enter the storage area, the up counter increments by 1 (%I0001 closes), increasing the current value of the parts in storage by a value of 1. When a part leaves the storage area, the down counter decrements by 1 (%I0002 closes), decreasing the inventory storage value by 1. To avoid conflict with the shared register, both counters use different register addresses. When a register counts, its current value is moved to the current value register of the other counter. In the following example, %I0001 increments the count, %I0002 decrements the count, %I0009 resets the count to zero, and %I0003, when on, holds the count at its current value regardless of what %I0001 and %I0002 do. The count value can be read from %R0100. | | _____ |%I0003 | | | - - | | - - + - - - - - - - - - - - - - - - - >UPCTR| | | | | |%I0001 | | | + - - | | - - + + - - - - - - - - +R | | | | | |%I0009 | | | + - - | | - - - - - - - - - - + CONST -+PV | | +00005 | | | +_____+ | | %R0100 | | _____ |%I0003 | | | - - | | - - + - - - - - - - - - +MOVE_+ | | |INT | |%I0001 | | | + - - | | - - + %R0100 -+IN Q|–%R0104 | | LEN | | |00001| | |_____| | | _____ |%I0003 | | | - - | | - - + - - - - - - - - - - - - - - - - >DNCTR| | | | | |%I0002 | | | + - - | | - - + + - - - - - - - - +R | | | | | |%I0009 | | | + - - | | - - - - - - - - - - + CONST -+PV | | +00005 | | | +_____+ | | %R0104 | | _____ |%I0002 | | | - - | | - - + - - - - - - - - - +MOVE_+ | | |INT | |%I0003 | | | + - - | | - - + %R0104 -+IN Q|-%R0100 | | LEN | | |00001| | |_____| |

GFK-0467M

Chapter 5 Timers and Counters

5-15

Page 105

5 A second method to provide storage tracking, shown below, uses ADD and SUB functions that share a common register, %R00201, on their outputs. When the count increases ($I0004 closes), the ADD instruction increments the value in %R00201. When the count decreases (%I0005 closes), the SUB instruction decrements the value in %R00201. In this case, transition coils are used to provide “one-shot” inputs to the ADD and SUB functions. If the enable inputs were not one-shot types, the ADD and SUB functions would execute once for every scan that they were enabled. (Transition coils are not needed with UPDTR and DNCTR functions since their enable inputs have a built-in transition function.) See Chapter 6 for details about the ADD and SUB functions.

| | |%I0004 %M0001 + - - - | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (↑) - | | |%I0005 %M0002 + - - | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (↑) - | | | _____ |%M0001 | | | - - | | - - - | ADD_| - | | | | | INT | | | | - |%R0201, |I1 Q| - %R00201 | | | | | | | CONST, |I2 | | +00001 |_____| | | | | _____ |%M0002 | | | - - | | - - - | SUB_| - | | | | | INT | | | | |%R0201, |I1 Q| - %R00201 | | | | | | | CONST, |I2 | | +00001 |_____| |

5-16

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

GFK-0467M