The Pulse Width Modulation function block commands a pulse width modulated signal output at the specified frequency and duty cycle.
To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation.
This table describes the input variables:
Inputs |
Type |
Comment |
---|---|---|
EN_Enable |
BOOL |
TRUE = authorizes the PWM enable via the IN_Enable input (if configured). |
F_Enable |
BOOL |
TRUE = forces the Enable function. |
EN_SYNC |
BOOL |
TRUE = authorizes the restart via the IN_Sync input of the internal timer relative to the time base (if configured). |
F_SYNC |
BOOL |
On rising edge, forces a restart of the internal timer relative to the time base. |
Frequency |
DWORD |
Frequency of the PWM output signal (range: min 100 (10 Hz)...max 650,000(65 kHz)). |
Duty |
BYTE |
Duty cycle of the Pulse Width Modulation output signal in % (range: min 0...max 100). |
This table describes the output variables:
Outputs |
Type |
Comment |
---|---|---|
InFrequency |
BOOL |
TRUE = the Pulse Width Modulation signal is currently being output at the specified frequency and duty cycle. |
Busy |
BOOL |
Busy is used to indicate that a command change is in progress: the frequency is changed. Set to TRUE when the Enable command is set and the Frequency Generator signal is not output at the specified Frequency. Reset to FALSE when InFrequency or Error is set, or when the Enable command is reset. When a command change execution is immediate, Busy remains FALSE. |
Error |
BOOL |
TRUE = indicates that an error was detected. |
ErrID |
When Error is set: type of the detected error. |