Instructions
389 C-Control Pro IDE
© 2013 Conrad Electronic
5.26.2.3
Pulse Width Modulation
The C-Control AVR32Bit can output a pulse width modulated signal on up to 4 channels. The follow-
ing Example 1 will produce a signal of 1.65 MHz period, and 50% duty on PWM channel 1.
After 10 seconds, the PWM channel is switched off. The signal is output to pin PWMH_1 and
PWML_1 (see Pin Assignment).
Example
void main(void)
{
PWM_Init(1, PWM_1, PWM_ENAB_HIGH|PWM_ENAB_LOW);
PWM_Update(1, 40L, 20L, 0, 0);
AbsDelay(10000);
PWM_Disable(1);
}
5.26.2.4 PWM_Disable
Timer Functions
Syntax
void PWM_Disable(byte chan);
Sub PWM_Disable(chan As Byte)
Description
The function switches off the selected PWM channel.
Parameter
chan number of the PWM channel (0 - 3)
5.26.2.5 PWM_Init
Timer Functions
Syntax
void PWM_Init(byte chan, byte PS, byte mode);
Sub PWM_Init(chan As Byte, PS As Byte, mode As Byte)
Description
Initializes a PWM channel. With the mode parameter can be selected individually, whether the sig-
nal is output on PWMH_x and / or PWML_x. A deadtime can be enabled or the polarity negated.