>I am working on a pulse meter >I want to use a 16f84 or 16f627-628 >Supouse that the normal pulse is beetwen min.0 and max.240 >So in that case i have a frequency beetwen 0-4 pulse/sec. >How can i measure the time beetwen 2 pulses using the rb0/int interrupt >and 4MHz clock. >I need to have a number beetwen 0-240 after to interrupts This is hilarious. I was just looking for a better method to calculate RPM last week. Basically the same thing. I ended up not using the 'time between pulse' method because of the calculations involved. I used "pulses per a period of time" multiplied by a constant to bring it to RPM, but since I had so many pulses to count, the error was reduced. You couldn't do that here because of the low number of pulses. If you want to time the pulses, just set up a 16-bit counter on TMR0 as described below. Then, take 60,000,000 and divide it by the timer value between pulses to get 'pulses per minute'. There are routines out there for division: http://204.210.50.240/techref/microchip/math/basic.htm 1) enable TMR0 interrupt on Tcy. Clear TMR0 and counter on first pulse 2) every TMR0 overflow, increment the 16-bit counter 3) for a range of 0-4 pulses per second, or .25 seconds per pulse, you'll have an upper byte value <4 and a middle byte value 0-255. The remaining TMR0 is your lowest byte. Then you just perform the division to get your 'pulses per minute'. --Andrew _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu