page 92
Function
PWM
Library CRxxxx.LIB
Function symbol
Purpose
The function is used to initialise and parameterise the PWM
outputs.
Parameter
Function inputs
Function outputs, none
Description
Function PWM has more than just a technical background. Due
to their construction the PWM values can be read out at a very
high resolution, so that this function is suitable for high-accuracy
proportional control.
Function PWM is called up once for each channel during
initialisation of the user program. Input INIT has to be set to
TRUE. During initialisation the parameter RELOAD is
transferred.
Name Data type Description
INIT BOOL TRUE: PWM output is initialised
FALSE: PWM is allocated new values
RELOAD WORD value to define the PWM frequency
DIV64 BOOL CPU cycle / 64
CHANNEL BYTE current PWM channel/output
VALUE WORD current PWM value
CHANGE BOOL TRUE: new PWM value is taken over
FALSE: changed PWM value has no
influence on the output
DITHER_
VALUE
WORD amplitude of the dither value
DITHER_
DIVIDER
WORD dither frequency = PWM frequency/DIVIDER