ImpulseCounter
ImpulseCounter (FB)
ImpulseCounter (FB)FUNCTION_BLOCK ImpulseCounter
Short description
Counter for input impulses with reset input and adjustable reduction \
Representation

Interfaces
Inputs
xImpulse
BOOL
Counter input
xReset
BOOL
FALSE
Reset input
Outputs
udiImpulseCounter
UDINT
Impulse counter
udiEnergy
UDINT
Impulse counter after reduction
dtLastImpulse
DATE_AND_TIME
Date/time of the end of the last counting pulse
Setpoints / Parameters
udiEnergyFactor
UDINT
1
Reduction factor
Function description
General
This function block is used to count the impulses ( = rising edges ) at the counter input xImpulse within the technical limits. The counter value is displayed at the output udiImpulseCounter If the counter value exceeds / reaches udiImpulseCounter the threshold value udiEnergyFactor, the output udiEnergy is incremented. Subsequently the output udiImpulseCounter is reset to 0. The outputs udiImpulseCounter and udiEnergy are reset to 0 as long as a rising edge is detected at the input xReset . At the output dtLastImpulse the current date / time is available after each rising edge at the input xImpulse . At the output dtLastImpulse the date / time at the end of the last rising edge is available for all other input states. At the output xImpulse the initialization value DT#1970-1-1-0.0.0 is output before the first rising edge.\ dtLastImpulse Wertebereiche der Ausgänge
Valid counter values are within the limits 0 and 4294967295. Incrementing the counter value 4294967295 resets the counter value to 0. Subsequently the counter value is continuously incremented again.\ udiImpulseCounter and udiEnergy
Reduction factor udiEnergyFactor
The reduction factor
is overwritten with the value 1 after each entry of the value 0.\ udiEnergyFactor Example - reduction factor
= 10 After a rising edge at the input
udiImpulseCounter = 9, udiEnergy = 0, udiEnergyFactor the counter values change as follows: &#xNAN; xImpulse = 10\udiImpulseCounter = 0, udiEnergy = 1, udiEnergyFactor DT
CODESYS
InOut:
Input
xImpulse
BOOL
Input
xReset
BOOL
FALSE
Input Const
udiEnergyFactor
UDINT
Output
udiImpulseCounter
UDINT
Output
udiEnergy
UDINT
Output
dtLastImpulse
DT
Last updated

