void main(){unsignedint i;float j;float adc1,adc2;
adc1=0;
PORTA=1;
TRISA=0xff;
ADC_Init;
PORTC=0;
TRISC=0;
TRISB=0;
PR2 =0xFA;//oxFA for 250 (used to set time period)
PWM1_Init(5000);
PWM1_Start();// start PWM1
CCP2CON |=(1<<2)|(1<<3);// select for PWM mode
T2CON |=(1<<2)|(1<<1);// enabling timer 2, prescalar 16do{
adc1=ADC_Read(2);
adc2=ADC_Read(1);for(i=0;i<50;i++){
PWM1_Set_Duty(adc2);
CCPR2L=adc1;
PORTB.F3=PORTC.F1;
delay_us(10);}}while(1);}
i wrote this code to control a servo using a potentiometer the problem is when i simulate this on proteus the potentiometer sends signal from 5% to 14% is there any thing wrong with te code?