CNT_UP: Upward counter
The CNT_UP (FB444) block is a slope-controlled upward counter with a higher counter limit.
Functionality
If an increasing slope exists at input "Count up" [CntUp], the "CNT_UP" block increases the counter value [CntVal] by one. The counting increments are 1.
Note: In order to recognize a slope, the block must pass two machine cycles. As a result, the counts occur at the earliest after the second machine cycle.
Counter limit.
If the counter value reaches or exceeds the counter limit [CntValLm], output "Limit reached" [LmRd] = 1 (Yes) is set and the upward counter is stopped.
If the counter was started with a start value [SttVal] above the counter limit or if the counter limit was set to a value below the present counter value [CntVal], [LmRd] = 1 (Yes) and the upward counter is stopped.
The number of possible counting increments to the counter limit depends on the start value [SttVal] (or [CntReset]), the present counter value, and if the present counter value is above the counter limit.
Reset counter
If the input "Reset counter" is [CntReset] = 1 (Yes), the counter value remains at [CntVal] = 0 (not slope-controlled).
If [CntReset] = 0 (No), the counter starts.
A new counter process can be started simultaneously with [CntReset] and [CntUp]. The counter is initialized accordingly and upward counting begins.
Set start value.
If the input "Set start value" is [SetStt] = 1 (Yes), the counter value remains at [CntVal] = [SttVal] (not slope-controlled).
If [SetStt] = 0 (No), the counter starts at start value [SttVal].
If the start value [SttVal] is negative, the counter starts at value "0".
Inputs
Pin | E | Description |
CntUp | p | Count up |
CntReset | p | Reset counter |
CntValLm | pa | Counter limit. The counter limit [CntValLm] allows for negative values. |
SetStt | pa | Set start value. |
SttVal | pa | Start value. |
Outputs
Pin | E | Description |
CntVal | a | Counter value The counter can accept values above the counter upper limit, as values above [CntValLm] are possible for the counter start value [SttVal]. |
LmRd | a | Limit reached. |
Input values
Pin | Description | Data type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
CntUp | Count up. | Boolean | 0 (No) | No, Yes |
|
|
CntReset | Reset counter. | Boolean | 0 (No) | No, Yes |
|
|
CntValLm | Counter value limit. | Integer | 0 |
|
|
|
SetStt | Set start value. | Boolean | 0 (No) | No, Yes |
|
|
SttVal | Start value. | Integer | 0 |
|
|
|
Output values
Pin | Description | Data type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
CntVal | Counter value. | Integer | 0 |
|
|
|
LmRd | Limit reached. | Boolean | 0 (No) | No, Yes |
|
|
Process response
The block 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.
Note: A continuous signal at input [CntUp] is recognized as an increasing slope on startup.
Troubleshooting
Standard (see General rules and information).