hey, so, i made a code to control pwm output with a pot on adc chanel (AN2), i run it on proteus and it works perfect, just as i wanted, but in the actual real circuit it doesnt behave like that, the change on the duty cycle is small, why is not acting like on proteus?
the pic is 16f887 btw
here is the code
unsigned adc;
void Initmain() {
ANSEL = 0x04;
ANSELH = 0;
TRISA = 1;
TRISC = 0;
PORTC = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
PWM1_Init(5000);
}
void main(){
Initmain();
adc = 0;
PWM1_Start();
PWM1_Set_Duty(adc);
while (1) {
adc = ADC_READ(2);
PWM1_Set_Duty(adc);
}
delay_ms(5);
}