Topic: DMD0030

CNT - Up Counter


The Up Counter (CNT) instruction is a two input counter that counts from 0 up to the Preset value. Each time the UP input logic transitions from OFF to ON the counter structure's accumulator (.Acc) is incremented by one. The counter structure's .Done bit will turn ON once the .Acc value reaches the Instruction's Preset value.

 

Parameters:

Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.

 

Counter Struct - a counter structure that will be used by this Up Counter instruction. By default, there are 255 pre-defined counter structures, named CT0 through CT255. Refer to the Memory Configuration section of the System Configuration for information on adjusting the number of available counter structures.

 

Preset - the count value at which the Up Counter is said to be "done". Any time the value in the counter structure's Accumulator (.Acc) is greater than or equal to the Preset value the counter structure's .Done member will be  ON. This can be any positive 32-bit constant value or any readable numeric location.

 

Inputs Legs:

The Up Counter (CNT) has the following two ladder logic inputs:

 

The first input leg is the Count Input (UP). The gray triangle at the right end of this input leg indicates the input is edge-triggered, meaning that each time this input logic transitions from OFF to ON, the Up Counter's accumulator value will increment by one.

 

The second input leg is the Count Reset (RST). When this input logic in ON, the Up Counter will reset and the counter structure's accumulator value will return to 0 and will remain in this state as long as the Reset input remains ON.
 

Note: The Reset input has priority over the Up input, meaning that if the Up input is ON at the same time as the Reset input, the Up Counter will not count.

 


Status Display:

The yellow triangle in the upper left corner indicates this is a Multi-Scan instruction.

 

The counter structure contains several "dot" fields that can be used elsewhere in your ladder program. Their values are updated each time the Up Counter instruction is processed. The syntax for using them is <counter struct>.<flag name>.

 

  • .Acc (Read/write) - a 32-bit integer value that represents the current number of counts that have accrued
     
  • .Done - (Read-only) is ON any time the value in the counter structure's Accumulator (.Acc) is greater than or equal to the Instruction's Preset value
     
  • .Reset - (Read-only) is ON if the RESET logic is ON, or if the Up Counter is being reset by a Reset Counter (RSTCT) instruction
     
  • .Zero - (Read-only) is ON any time the value in the counter structure's (.Acc) is 0

 


See Also:

 


Example:

 


Copyright © Host Engineering, Inc. ALL RIGHTS RESERVED