Jinx wrote: > Should I be timing input edges with another timer and using that > measurement to indicate whether CCP is > 61Hz ? Bearing in mind > that at some times the turbine will be stopped or moving very slowly, > leading to huge counts in a timer. Or is there another method ? > > Any ideas, links to similar projects etc, welcome and appreciated I did some flow meters a long time ago that had to cover a large dynamic range. I used a CCP module in capture mode to get the period between pulses, but had to deal with timer 1 overflow issues. I essentially extended the timer in software to 24 bits, which happened to be enough for this application. This technique can be used to extend it any number of bytes you want. Your timer 1 overflow period is 16.4mS. All you need is some code that is guaranteed to run a little more often than that. This code grabs the timer 0 high byte, finds the delta from the last time it did that, then adds that delta into a software accumulator. The software accumulator must be more than 8 bits to be useful. Any bits past the first 8 essentially extend the timer. The procedure above makes the software accumulator up to date with the latest high byte of timer 1. In the capture interrupt, the total period is the period indicated by the timer 1 low byte difference, plus the timer 1 high byte difference from its last updated value, plus the software accumulator. You then clear the software accumulator, update the timer 1 old low byte, and update the timer 1 old high byte used by the software accumulator update routine. Yes, you have to wake up to make sure you are thinking thru all the boundary cases properly, but it can definitely be done. I probably still have the code on a dusty archive disk somewhere. These flow meters were some of the first PIC projects I ever did, so the code probably isn't that pretty. I can try to find it if you really want to see it. It runs on a 16C923 if I remember right. The PIC measured the period, inverted it to make flow, then displayed that on the LCD. I think this is the project I originally wrote the 32 bit fixed point multiply and divide routines for. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist