[CNT_UP] Upward counter

Function block CNT_UP is an edge-controlled upward counter.

CNT_UP is an edge-controlled upward counter with set value 1 as increment and counter value limit.

Functioning

Counter increments and counting

If an increasing edge exists at input [CntUp], CNT_DN increases the counter value [CntVal] by one increment. The counting increments are 1.

info

In order to identify a slope, CNT_UP must pass two machine cycles. As a result, the counts occur at the earliest after the second machine cycle.

Counter limit.

  • If the upper counter limit 0 [CntValLm] is reached or exceeded, counting is stopped and output upper limit is reached [ZeRd] = 1.
  • If the counter value limit [CntValLm] is thus exceeded, so that a counter value [CntVal] above the counter limit value [CntValLm] is used for starting or the counter upper limit [CntValLm] is set to a value below the present counter value [CntVal], then counting is stopped and output [LmRd] = 1.
  • The number of possible count increments until the counter upper limit [CntValLm] is reached, depends on the counter start value [SttVal] or the counter reset [CntReset], on the present counter value [CntVal] and on whether or not the counter value [CntVal] is above the counter upper limit [CntValLm].

Reset counter

  • If the input is [CntReset] = 1, the counter value remains at [CntVal] = 0 (not edge-controlled).
  • If [CntReset] = 0, counting starts.
  • A new counter process can be started simultaneously with [CntReset] and [CntUp]. The counter value [CntVal] is initialized and increased accordingly.

Set start value.

  • If the input Set start value is [SetStt] = 1, the counter value remains at [CntVal] = [SttVal] (not edge-controlled).
  • If [SetStt] = 0, the counter starts at counter start value [CntVal] = [SttVal].
  • If the counter start value [SttVal] is negative, counting starts at counter value 0.
Pins

Input

Description

Data type

Default value
Value range

CntUp

Count up

Boolean

0

0 - No
1 - Yes

CntReset

Reset counter

Boolean

0

0 - No
1 - Yes

CntValLm

Counter value limit

Double integer

0

SetStt

Set start value

Boolean

0

0 - Do not set start value.
1 - Set start value.

SttVal

Start value

Double integer

0

 

Output

Description

Data type

Default value
Value range

CntVal

Counter value

Double integer

0

LmRd

Limit reached

Efficiency [Efcy] has reached the efficiency limit [EfcyLm].

Boolean

0

0 - Limit not reached.
1 - Limit reached.

Process response

CNT_DN is processed with the values at the inputs from the second process cycle onward, as the values at the inputs are considered valid only then. Default values are issued during the first process cycle.

info

A continuous signal at input [CntUp] is recognized as an increasing slope on startup.