Pwm-16f877a-frequence-controlling
Posted: 12 May 2012 18:05
hi everyone,
iam doing a project on pic 16f877a iam almost done with it just one problem left and that is that i cant increment or decrement my Frequence i know how to set up my Frq lvl an that is
PWM1_init();
so i can set my freq but i want to do incrment or decrement in it with two push buttons like iam changing the Duty here just shown blow
if(RD0_Bit) {
if(duty<=255) {
Delay_ms(10);
Work++;
PWM1_Set_Duty(duty);
}
}
if(RD1_Bit) {
if(duty>=1) {
Delay_ms(10);
Work--;
PWM1_Set_Duty(duty);
}
}
ya just like iam changing the duty i wana change the Frequence
iam doing a project on pic 16f877a iam almost done with it just one problem left and that is that i cant increment or decrement my Frequence i know how to set up my Frq lvl an that is
PWM1_init();
so i can set my freq but i want to do incrment or decrement in it with two push buttons like iam changing the Duty here just shown blow
if(RD0_Bit) {
if(duty<=255) {
Delay_ms(10);
Work++;
PWM1_Set_Duty(duty);
}
}
if(RD1_Bit) {
if(duty>=1) {
Delay_ms(10);
Work--;
PWM1_Set_Duty(duty);
}
}
ya just like iam changing the duty i wana change the Frequence