Do a search for Frequency Counting, and you will find a great example that Bruce did for someone using Darrel Taylor's Instant Interrupts to trigger on a rising edge, and then trigger again later on the falling edge. I think you can easily modify it for your project, and by using interrupts you'll free up a lot of microprocessor time.
Good Luck!
Jerry.
Bookmarks