PWM_Creator_FixedCycle (FB)

FUNCTION_BLOCK FINAL PWM_Creator_FixedCycle EXTENDS PWM_CreatorBase

Represents a two point controller with pulse width modulation using a fixed cycle width.

Note

If the cycle time given by udiWidthCycleTime can not be divided without remainder by the cycle time of the task calling this FB, the number of ON-cycles is calculated as defined by eRoundingStrategy

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

xEnable

BOOL

TRUE: Activates the defined operation FALSE: Aborts/resets the defined operation

LConC

Output

xBusy

BOOL

TRUE: Operation is running

LConC

xError

BOOL

TRUE: Error condition reached

LConC

Input

lrProportionValue

LREAL

Represents the demanded proportional value for the pwm controller between 0 and 1
If this value is out of range an error is produced.

PWM_CreatorBase

Output

xOutput

BOOL

Represents the boolean output value

PWM_CreatorBase

eErrorID

ERROR

ERROR.NO_ERROR

The current error.
Only valid if xError is TRUE.

PWM_CreatorBase

Input

udiPWMCycleTime

UDINT

The cycle time in µs

Input Const

eRoundingStrategy

RoundingStrategy

RoundingStrategy.round

The strategy being used to deal with the remainder of the PWM-CycleTime divided by the task cycle time calling this FB

Methods:

Structure: