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:
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:
and then just
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":
//DDRA &= ~(1<<DDA0);
//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.