Andre, LUT is short for Look-Up Table. There are two primary ways to measure the frequency -- (1) as you were =20 thinking, count the number of cycles that occur in a given amount of =20 time, and (2) as others suggested, have some timer counting at fixed =20 intervals and count how many of those occur in one pulse of your =20 engine tach signal. (1) works better for higher frequencies, and (2) =20 is better for low frequencies. I've done a frequency counter before, =20 using a hybrid of both. For a four-stroke engine, you should have 1 pulse per cylinder for =20 every 2 crank cycles, so for a 4-cylinder 4-stroke engine, you'll get =20 2 pulses every crank cycle. I think you understand (1), but for (2), setup a time that triggers an =20 interrupt every say 1/1,000th of a second, (so 0.001 seconds between =20 pulses). So 800 rpm =3D=3D> 1600 pulses/min =3D 26.67 pulses/sec (or 26.67= =20 Hz). So the period of each pulse is 1/26.67 =3D 0.0375 sec. With your =20 interrupt interval, you should be able to count 37 or 38 pulses in =20 this time. Then you can calculate the reciprocal of that (1/37) to get the =20 frequency, and multiply by ((60 x 1000) / 2) to get the rpm. Ex: (60 =20 x 1000) / (2 x 37) =3D 810 rpm. You can change the timer interrupt =20 interval to get more resolution if you need it. For that last part (the division), you can use a look-up table, and =20 not have to do the math in a PIC. Cheers, -Neil. Quoting Andre Abelian : > David, > > sorry I am not familiar with your method at all. I know what LUT is but > I do not know how you did it? can you give brief explanation? > thanks > > Andre > > > > > ________________________________ > From: David VanHorn > To: Microcontroller discussion list - Public. > Sent: Mon, February 14, 2011 10:37:01 AM > Subject: Re: [PIC] RPM measurement question > > Depending on the accuracy you need, and the code space available, > lookup tables can be your friend. Do the hard math externally, and > just look up the answer. > > I used LUTs when taking Shannon's entropy for 10 different analog and > digital sensors in a security sensor application. MUCH faster than > computing it all from scratch. > > Also, scale your variables. Normally Shannon's entropy is expressed > as 0-1 in floating point, but expressing it as 0-255 in integer was > plenty good enough for my application, and much faster. > > Do you NEED to know 1999 vs 20000 rpm? > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .