In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Okay so 7000 RPM is 420KHz. Which is slightly slower than your PWM update frequency (500KHz), that is good. Here is how I would go about it: Connect the tach signal to port B pins so you can use the WK_Pend register to see if a tach signal occured when you weren't in the interrupt. Create an interrupt to occurs every 2uSec. In the interrupt: Update the PWM See if WK_Pend is set if it is increase a counter and clear it. In the main code (not in the interrupt). Check to see if the counter is too high or too low and adjust the PWM value using PID or whatever you want. Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=124203#m125033 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)