Up/Down counter

image\block_vrz_sn.gif

Short description

An input pulse increments or decrements an internal value, depending on the parameter setting. The output is set or reset when a configured threshold is reached. The direction of count can be changed with a signal at input Dir.

 

Connection

Description

Input R

You reset the output and the internal counter value to the start value (StartVal) with a signal at input R (Reset).

Input Cnt

This function counts the 0 to 1 transitions at input Cnt. It does not count 1 to 0 transitions.

  • Use the inputs I3, I4, I5, and I6 for high-frequency counts (LOGO! 12/24 RC/RCo and LOGO! 24/24o): max. 2 kHz.

  • Use any other input or circuit element for low-frequency counts (typically 4 Hz).

Input Dir

Input Dir (Direction) determines the direction of count:

Dir = 0: Up
Dir = 1: Down

Parameter

On: On threshold

 Value range: 0...999999

Off: Off threshold

 Value range: 0...999999

StartVal: Initial value from which to begin counting either down or up.

Retentivity set (on) = the status is retentive in memory.

Output Q

Q is set and reset according to the actual value at Cnt and the set thresholds.

Parameters On and Off

The on threshold On and the off threshold Off can be provided by the value of another already-programmed function:

You select the required function by the block number.

Timing diagram

image\block_vrz_diagramm_sn.gif

Description of the function

The function increments (Dir = 0) or decrements (Dir = 1) the internal counter by one count with every positive edge at input Cnt.

You can reset the internal counter value to the start value with a signal at the reset input R. As long as R=1, the output Q is 0 and the pulses at input Cnt are not counted.

Output Q is set and reset according to the actual value at Cnt and the set thresholds. See the following rules for calculation.

Calculation rule

 

image\0ba3_logo_sn.gif

0BA0-0BA5:

The Start Value parameter does not exist. The counter always counts up or down from 0.

0BA0-0BA3:

The off parameter does not exist. The calculation rule is therefore void.

Caution

The function polls the limit value of the counter once in each cycle.

Thus, if the pulses at the fast inputs I3, I4, I5, or I6 are faster than the scan cycle time, the SFB might not switch until the specified limit has been exceeded.

Example: Up to 100 pulses per cycle can be counted; 900 pulses have been counted so far. On = 950; Off = 10000. The output is set in the next cycle, after the value has reached 1000.

The output would not be set at all if the value Off = 980

Scan cycle time

For information on how to determine the scan cycle time of a LOGO!, refer to the appendix in the LOGO! manual.

 

Overview