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.
|
Input Dir |
Input Dir (Direction) determines the direction of count: Dir = 0: Up |
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:
Analog comparator: Ax – Ay
Analog trigger: Ax
Analog amplifier: Ax
Analog multiplexer: AQ
Analog ramp: AQ
Analog math: AQ
PI controller: AQ
Up/Down counter: Cnt
You select the required function by the block number.
Timing diagram
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
If the on threshold >= off threshold, then:
Q = 1, if Cnt >= On
Q = 0, if Cnt < Off.
If the on threshold < off threshold, then:
Q = 1, if On <= Cnt < Off.
|
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.