Quote:
|
Originally Posted by Josh Siegel
I am using the 2004 controller now and having some luck, I just need to write a filtering algorithm to help clean up the data some. My question, though, is on the interfacing of my PWM sensor.
I know this is meant only for a true radio system, but shouldn't there be some other way to measure pulse width? My sensor is wired properly, with the 5V to the 5V, that tied to the I2C lines according to the documentation, GND to GND, and PWM to the signal wire. I am using a CMPS03 sensor, and the pulse widths relate as follows:
1mS to 36.99mS, or 1uS/degree with a 1mS offset. The signal goes low for 65mS between pulses.
Is there any way to make this work? I'm getting a radio data error, and the values show up as 127 regardless of how the sensor faces.
|
I dont know about CMPS03, but did you say I2C ? EDU RC has no I2C port, unless you write the interfacing code via an IO pin yourself.
If i'm not wrong you'll have to: 1) custom code the CCP on the microprocessor to process your custom-pwm signal, or 2) tie the pwm source to an interrupt pin, have a 16bit running timer in the background, have the interrupt trigger on both rising and falling edges, and write code to capture the timer's values per interrupt trigger. The difference between the captured values should be proportional to the pulse width.
hope this helps, but I'm abut skeptical on method 2 unless you have a way to pull the whole 16bit value in 1 command instead of 2 seperate 8 bit reads to ensure accuracy.
