Ctd (count-down counter), Ctd (count-down counter) -9 – Sensaphone SCADA 3000 Users manual User Manual

Page 165

Advertising
background image

15-9

Chapter 15: Ladder Logic Programming

Element Function
Number Description

Range of Values

0

Up Counter Enabled

0 or 1 (0=disabled, 1=enabled)

1

Down Counter Enabled

0 or 1 (0=disabled, 1=enabled)

2

Counter Done

0 or 1 (0=disabled, 1=enabled)

3

Counter Overflow

0 or 1 (0=disabled, 1=enabled)

4

Counter Underflow

0 or 1 (0=disabled, 1=enabled)

5

Counter Preset

-32,768 to 32,767

6

Counter Value

-32,768 to 32,767

Examples:

N,0,0 This UAF indicates if Counter 0 is enabled or disabled.

N,19,7 References the current value of Counter number 19.

The counter value and status bits can be viewed or changed from the Counter Status form.

To view the counter values, click on the Ladder and C Variables button from the Toolbar on

the Main Programming form. Select the Counters tab. In addition to viewing the state of the

counter values, you can also force changes by double-clicking on the counter value you want to

change. A Change form will appear to let you enter a new value for the counter. Use the Up/

Down arrows to flip through the pages to access the counters you wish to view.

CTD (Count-Down Counter)

This instruction counts down false-to-true rung transitions starting from 0. Rung transi-

tions can be caused by events occurring in the program (internal logic) or by external field

devices. When rung conditions for a CTD instruction have made a false-to-true transition, the

COUNT value is decremented by one, provided that the rung containing the CTD instruc-

tion 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 (see ladder timing specifi-

cations). The COUNT value is retained when the rung conditions again become false. The

COUNT can only be set to zero using the RES(RESET) instruction that has the same address

as the counter. The counter underflows at -32768, but will continue counting from 32767 if

not reset. The counter bits are updated as follows:

ENABLED: Set when rung is true, and reset when rung is false. Also reset from a

RES(RESET) ladder instruction.

DONE: Set when the COUNT is greater than or equal to the PRESET value.

Reset when COUNT is less than PRESET.

UNDERFLOW: Set when the COUNT decrements below -32768. Resets

when the COUNT is incremented greater than or equal to +32768 with a CTU

instruction or by the RES(RESET) instruction.

The CTD address identifies the register where the COUNT value is stored. The counter

address can only reference one of the 64 internal counters: N,0 through N,63. Right-click on

the instruction and choose Select Counter. A list of the 64 counters will be displayed. Select

one and click OK. Next, set the preset by right-clicking on the instruction and choosing Set

Preset. Enter the preset value and click OK. You may use the CTD instruction in combination

with the CTU function—one increments the count and the other decrements the count—by

Advertising