TrigGen
TrigGen (FB)
FUNCTION_BLOCK TrigGen
Short description
Pulse generation with adjustable time interval.
Representation

Interfaces
Inputs
xEn
BOOL
Enable input
wInterval
WORD
Time value for time interval
eTimeBase
eTimeMS
Time base for time interval
xEnImp
BOOL
Enable option for 1st pulse
Outputs
xTrig
BOOL
Pulse output
tNextImp
TIME
Remaining time until the next pulse
Functional description
General
At the pulse output xTrig pulses are generated cyclically with a duration of one program cycle and an interval of (wInterval multiplied by eTimeBase) are generated if the enable input xEn is active.
Limitation of the maximum time interval
The time interval is limited to a maximum of 48 days to avoid an internal value overflow.
Example for calculating the time interval
wIntervall = 1000, eTimeBase = Millisecond, pulses are generated in an interval of 1000 ms.
Enable 1st pulse xEnImp
With the option active (xEnImp = TRUE) the 1st pulse is generated immediately after enable xEn generated. With the option inactive (xEnImp = FALSE) the 1st pulse is generated after enable xEn after the elapsed time interval.

Remaining time until the next pulse tNextImp
At this output, the remaining time until the next pulse is displayed if the enable input is active (*xEn = TRUE). In all other situations, the constant 0.0 is displayed.

Codesys
InOut:
Input
xEn
BOOL
Input
wInterval
WORD
Input
eTimeBase
eTimeMS
Input
xEnImp
BOOL
Output
xTrig
BOOL
Output
tNextImp
TIME
Last updated

