FB_CTRL_PWM_OUT_EXT
This block creates a PWM modulated signal on the basis of the input signal. Both the minimum switch on time and the minimum switch off time can be parameterised, in addition to the mark-to-space ratio, in this extended block.
Description of the output behaviour (1):

Description of the output behavior (2):

VAR_INPUT
VAR_INPUT
fPwmInput : FLOAT; (* NEW: controller output = PMW input [-100.0 ... 100.0] *)
eMode : E_CTRL_MODE;
END_VAR
fPwmInput : Input value for the function block.
eMode : Input that specifies the block's operating mode.
VAR_OUTPUT
VAR_OUTPUT
bPwmOutBitPos : BOOL; (* PWM output bit *)
bPwmOutBitNeg : BOOL; (* PWM output bit *)
eState : E_CTRL_STATE;
bError : BOOL;
eErrorId : E_CTRL_ERRORCODES;
END_VAR
bPwmOutBitPos : PWM signal, when fPwmInput > 0.0.
bPwmOutBitNeg : PWM signal, when fPwmInput < 0.0.
bWaitTimeActive : A TRUE at this output indicates that the waiting time between the switching actions of the output signals is active. This output can be used to hold an I component that may be present in the prior controller constant during this time.
eState : State of the function block.
eErrorId : Supplies the error number when the bError output is set.
bError : Becomes TRUE, as soon as an error occurs.
VAR_IN_OUT
VAR_IN_OUT
stParams : ST_CTRL_PWM_OUT_EXT_PARAMS;
END_VAR
stParams : Parameter structure of the PWM element. This consists of the following elements:
TYPE
ST_CTRL_PWM_OUT_EXT_PARAMS :
STRUCT
tTaskCycleTime : TIME; (* PLC/PWM cycle time in seconds
*)
tPWMPeriod : TIME; (* controller cycle time in
seconds *)
tMinOnTime : TIME; (* min. switch on time *)
tMinOffTime : TIME; (* min. switch off time *)
tMinWaitTime : TIME; (* min. waiting time when
switching from pos to neg or vv*)
END_STRUCT
END_TYPE
tTaskCycleTime : Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task.
tPWMPeriod : Period of the PWM signal.
tMinOnTime : Minimum switch-on time.
tMinOffTime : Minimum switch-off time.
tMinWaitTime : Waiting time between switching between a positive and negative output signal.