Hi everyone,
I have been reading about CCP pins and interrupts, and am at a complete loss as to what the -simplest- way of timing an input pulse is. Here are the specifics of my application:
-The signal varies from 1mS to 36.99mS
-There is a 65mS low signal between pulses
-I am currently using, essentially, the default code (added sensor capture and filtering for sonar, but the framework is the same).
-It would be best if lag during capture could be avoided (so that the proc. doesn’t wait for a signal when it could be filtering, etc.)
-I will, obviously, need access to the up-to-date value as stored in a variable.
-My PWM generator specifies down to 10uS readability; 100uS would be fine for my purposes.
-The signal is 0V or 5V, through a sensor powered by the analog pins.
Now, I know interrupts can be used like the sonar code, tracking rising and falling edges of the square wave. I also gather that CCP can do this with one pin, and appears like it will not lag the program.
How can I impliment something like this? What code do I need to add to the default code? What pins do I use?
Thank you,
Josh