Guys thank you very much for the replies....
I am currently using a Resistor/Capacitor(R=12kohm, C=0.1uF) circuit to convert PWM into an analog signal and then fed to ADC. My issue is that the ADC outputs a very noisy signal ranging from 0.41V to 0.22V. The ADC vref is 2.56V. To smooth out the ADC output and to remove offset, I am performing a method:
a6=(a6-38);
if(loopCounter<=20){sum=sum+a6;loopCounter=loopCounter+1;}
else {throttle=sum*0.01;loopCounter=0;sum=0;}
This gives me a range of approx. 0-1000 for throttle stick movement from low to high. Still the numbers are jumping within 100's and only by dividing it with 100 I can get a solid 0-9 integer range. This is not enough for remote throttle control. I am looking for something like 0-250.
I am thinking about using a 10kohm, 10uF as per (
http://www.societyofrobots.com/remote_control_robot.shtml) and also adding a opamp to set the range to suit the ADC, but I really need to confirm if that will fix the noise issue? Square wave signals are really bad when noise is concerned.
The other option was to use the available PWM Capture I/O pins, but I really do not know exactly how to configure the code provided with Axon. I am only using timer 3&4 and have timer2&5 spare. Setting PWM for Servos was easy:
Initialize once
PWM_Init_timer3_E3(10);
timer3PWMInitICR(4999);//4999
PWM_Init_timer3_E4(10);
PWM_Init_timer4_H3(10);
timer4PWMInitICR(4999);
PWM_Init_timer4_H4(10);
PWM_timer3_On_E3();
PWM_timer3_On_E4();
PWM_timer4_On_H3();
PWM_timer4_On_H4();
and then just
PWM_timer3_Set_E3(250);
PWM_timer3_Set_E4(250);
PWM_timer4_Set_H3(250);
PWM_timer4_Set_H4(250); //250
bam motor works good! I was wondering if there is some way I can setup timer2 or 5 such that it checks the input based on interrupt and just let me read a value representing the incoming pulse width. Just the way mentioned above, its setup to run the motors on PWM? I hope it makes any sense

I liked the code from "Tsukubadaisei":
void radio(void){//ラジコンの出力パルスの幅を計る関数
int i;
//DDRA &= ~(1<<DDA0);
//PA0<->chan1
for(i=0;i<2;i++){
while((PINA&(1<<PINA0))==0){}
TCNT0=0;
TCCR0|=(1<<CS02);
while((PINA&(1<<PINA0))==1){}
TCCR0&=~(1<<CS02);
if(i==1){
chanVal[CHAN1]=TCNT0;
//printf("\r chan1 = %d\n",chanVal[CHAN1]);
}
}
........repeats so on...
However, its meant for a PPM signal, I am using individual DMUXED signals from 4-channels.
Admin, can you kindly help me with the code? I have timer2_H6 available, how can I read the pulse width from throttle using the "Axon Source Code v1.11" library files? Just one throttle channel will be fine for a start. My current code is working perfectly with "Axon Source Code v1.11" and currently I am not ready to switch to "Webbotlib", definitely in near future though.
Regards,
Ali.