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
Post a Comment