In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: John, You won't get more than one count per pulse with the code I gave you. Note that there is a bit variable called "lastScan" that is updated each time through. The only time the counter gets incremented is when the last scan was zero and the new scan is one; the code is looking for a low-to-high change on the sensor input line. And they can't come at the "wrong" time if you use a polled interrupt versus using edge triggered. The only thing you need to do is make sure your periodic interrupt is running fast enough to catch the pulses. How fast does your bike go? What is the distance from the axle to the magnet placement? What is the diameter of the magnets? With these numbers and a calculator you should be able to estimate -- pretty reasonably -- your pulse rate and pulse width. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231038 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)