ImpulseCounter
Last updated
ImpulseCounter (FB)FUNCTION_BLOCK ImpulseCounter
Counter for input pulses with reset input and adjustable reduction

xImpulse
BOOL
Counter input
xReset
BOOL
FALSE
Reset input
udiImpulseCounter
UDINT
Pulse counter
udiEnergy
UDINT
Pulse counter after reduction
dtLastImpulse
DATE_AND_TIME
Date/time of the end of the last counting pulse
udiEnergyFactor
UDINT
1
Reduction factor
This function block is used to count the pulses (= rising edges) at the counter input xImpulse within the technical limits. The counter value is shown at output udiImpulseCounter displayed. If the counter value udiImpulseCounter the limit value udiEnergyFactor, then the output udiEnergy is incremented. Then the output udiImpulseCounter is reset to 0. The outputs udiImpulseCounter and udiEnergy are reset to 0 as long as at input xReset a rising edge is detected. At output dtLastImpulse is available after each rising edge at input xImpulse the current date / the current time dtLastImpulse is available in all other states at input xImpulse the date / time at the end of the last rising edge is available. At output dtLastImpulse the initialization value DT#1970-1-1-0.0.0 is output before the first rising edge.
Value ranges of the outputs udiImpulseCounter and udiEnergy
Valid counter values are within the limits 0 and 4294967295. Incrementing the counter value 4294967295 resets the counter value to 0. Afterwards, the counter value is incremented continuously again.
Reduction factor udiEnergyFactor
The reduction factor udiEnergyFactor is overwritten with the value 1 after each input of the value 0.
Example - Reduction factor
udiImpulseCounter = 9, udiEnergy = 0, udiEnergyFactor = 10 After a rising edge at input xImpulse the counter values change as follows: udiImpulseCounter = 0, udiEnergy = 1, udiEnergyFactor = 10
InOut:
Input
xImpulse
BOOL
Input
xReset
BOOL
FALSE
Input Const
udiEnergyFactor
UDINT
Output
udiImpulseCounter
UDINT
Output
udiEnergy
UDINT
Output
dtLastImpulse
DT
Last updated

