FreescalePWM
 
Component FreescalePWM
Pulse width modulation - special version
Component Level: Low
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Required component name is "PWM1".

(BD48, LD64)
In the following example, there is PWM duty change set to 50% of the period of output signal while inserting 2 pulses in each 8-cycle frame.

 MAIN.C

void main(void)
{
  PWM1_SetPWM(15);        /* change duty to 50% (16 / 32 counter ticks) */
  PWM1_SetBRM(2);         /* insert 2 pulses in the 8-cycle frame */
  
  for(;;){}
}

(SR12)
In the following example, there is PWM generation disabled and subsequently enabled with phase difference 50% of the period of output signal.
 MAIN.C

void main(void)
{
  PWM1_Disable();         /* disable device */
  PWM1_SetPhaseReg(64);   /* write delay value 64 */
  PWM1_EnablePhase();     /* enable automatic phase control */
  PWM1_Enable();          /* start pwm generation with phase difference */

  for(;;){}
}