18F4550 PWM test with mikroc


//working
//model
//modified codes from mikroc example
//display results on pin 17 (ccp1,rc2)

void InitMain()
{
  PORTC = 0;                          // set PORTC to 0
  TRISC = 0;                          // designate PORTC pins as output
  PWM1_Init(5000);                 // Initialize PWM1 module at 5KHz
}

void main()
{
  initMain();
  current_duty     = 16;          // initial value for current_duty
  PWM1_Start();
        for(;;)
        {
      PWM1_Change_Duty(current_duty); //    set new duty ratio,
      Delay_ms(20);                    // slow down change pace a little
         }

}

Comments

Popular posts from this blog

stepper_28BY_and_with_driver_and-pic18f4550

Inductance caculator

polluted enviroment အဆိပ္သင့္ ရပ္ဝန္း