Denny Esterline wrote: >>>I'm sure I can find a way around this, but it seems like the kind of thing >>>that must have been done before. Maybe I don't have to reinvent the wheel :-) >>> >>>I have a sensor hooked to an input capture, the data I care about is >>>frequency. (DSPIC 30F4012, freq<3kHz if it matters) The input capture >>>trigers an interrupt every 16 pulses and I read a timer value. This works, >>>but it's not actualy measuring frequency, it measures period which is >>>1/frequency. The result is an exponential function when I wanted a linear >>>one. How have other people dealt with this? >> >> frequency = 1/period. If you want it refreshed with every 16 pulses, >> you will have more than 5 msec to do the calculation, which should be >> plenty on regular PIC let alone a dsPIC. > > Like I said, I'm sure I can find a way around this, the math to do > 1/period is certainly one way. Or a lookup table, or changing it to > count pulses over a timer interrupt. All of which have various > drawbacks, I was realy just polling for other peoples ideas. Depending on your measuring range, resolution and measuring interval requirements, you can set a fixed timer interrupt and read the pulse count between the interrupts -- which is proportional to the frequency. When the frequency to be measured is high compared to the measuring frequency, that works. But this doesn't sound to be your case. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist