TrigGen

TrigGen (FB)

FUNCTION_BLOCK TrigGen

Short description

Pulse generation with adjustable time interval.

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

xEn

BOOL

Enable input

wInterval

WORD

Time value for time interval

eTimeBase

eTimeMS

Time base for time interval

xEnImp

BOOL

Option enable 1st pulse

Outputs

Name
Data type
Value range
Initial value
Function

xTrig

BOOL

Pulse output

tNextImp

TIME

Remaining time until the next pulse

Function description

General

At the pulse output xTrig pulses with a duration of one program cycle and a time interval of (wInterval multiplied by eTimeBase) are generated cyclically 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 at a time interval of 1000 ms.

Enable 1st pulse xEnImp

When the option is active (xEnImp = TRUE) the 1st pulse is generated immediately after the enable. xEn is generated. If the option is not active (xEnImp = FALSE) the 1st pulse is generated after the enable xEn after the expiry of a time interval.

Remaining time until the next pulse tNextImp

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

Codesys

InOut:

Scope
Name
Type

Input

xEn

BOOL

Input

wInterval

WORD

Input

eTimeBase

eTimeMS

Input

xEnImp

BOOL

Output

xTrig

BOOL

Output

tNextImp

TIME

Last updated