> I would have the interrupt routine compute the period, > low pass filter that a little, then leave it lying around for > the foreground to to grab when it wants. In general that is not a good idea to load the sensor event interrupt routine with the calcs. The sensor event interrupt should be of the highest priority and its mission should be to persist the current state only. > The foreground code grabs the current period value > maybe twice a second, inverts it to make speed, and > displays the result. There should be middle level (I'd say Business Level) code to deal with the persisted state. Its output should be meaningful values, like speed, distance etc. And there should be UI (User Interface) level code to display the BL level output. > Decoupling the period measurement from the display > actually solves more problems than it creates. That's very true. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist