I am using the 18F6722, and the pulses are being measured on PORTE, Pin 7. The pulse is roughly 340ms
I am using the 18F6722, and the pulses are being measured on PORTE, Pin 7. The pulse is roughly 340ms
Your pulses seem slow enough that you could do that with a PBP interrupt.
Look at Darrel Taylor's Instant Interrupts.
You could set up a 65mSec (or so) TMR0 interrrupt, and in the ISR, read the state of the input pin, XOR it with the last value you read from that pin (something like "oldpinvalue"), if the XOR value is "1", increment a counter. Then copy the pin's state to oldpinvalue in preparation for the next interrupt.
Since you have a (more or less) precision timer going with the interrupt, you will know exactly how many changes (pulses X 2) you got in any given time interval.
Charles Linquist
Bookmarks