Count up (ctu) – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 143

Advertising
background image

Chapter 8
Using Basic Instructions

8–24

How Counters Work

The figure below demonstrates how a counter works. The count value must
remain in the range of –32,768 to

+

32,767. If the count value goes above

+

32,767 or below –32,768, a counter status overflow (OV) or underflow

(UN) bit is set.

A counter can be reset to zero using the reset (RES) instruction. (See page
8–27.)

Underflow

Overflow

–32,768

+32,767

Count Up

0

Count Down

Counter Accumulator Value

(CTU)

(CTD)

The CTU is an instruction that counts false-to-true rung transitions. Rung
transitions can be caused by events occurring in the program (from internal
logic or by external field devices) such as parts traveling past a detector or
actuating a limit switch.

When rung conditions for a CTU instruction have made a false-to-true
transition, the accumulated value is incremented by one count, provided that
the rung containing the CTU instruction is evaluated between these
transitions. The ability of the counter to detect false-to-true transitions
depends on the speed (frequency) of the incoming signal.

Important: The on and off duration of an incoming signal must not be faster

than the scan time x2 (assuming a 50% duty cycle).

The accumulated value is retained when the rung conditions again become
false. The accumulated count is retained until cleared by a reset (RES)
instruction that has the same address as the counter reset.

Using Status Bits

This Bit

Is Set When

And Remains Set Until One

of the Following

Count Up Overflow Bit OV
(bit 12)

accumulated value wraps
around to –32,768 (from
+32,767) and continues
counting up from there

a RES instruction having the
same address as the CTU
instruction is executed OR
the count is decremented less
than or equal to +32,767 with a
CTD instruction

Done Bit DN (bit 13)

accumulated value is equal to
or greater than the preset value

the accumulated value
becomes less than the preset

Count Up Enable Bit EN
(bit 15)

rung conditions are true

rung conditions go false OR
a RES instruction having the
same address as the CTU
instruction is enabled

(CU)

(DN)

CTU

COUNT UP
Counter

C5:0

Preset

120

Accum

0

Execution Times (

µ

sec) when:

True

False

29.84

26.67

Ladder representation:

Count Up (CTU)

Advertising