In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mebikerider wrote: Here are a few ideas. You could have your start and stop events trigger two input pins, each set up to interrupt the SX on transition. Also configure the SX to interrupt on RTCC rollover. Set up several bytes to be the count variable, and keep a state variable byte. In the ISR, the ISR would need to figure out why it was interrupted, and do the right thing: on the start event, zero the count variables and set the state to "counting". On the stop event, set the state to "stopped". On RTCC rollover, if the state is "counting", increment the count variables. Ordinarily, you'd need to take extra care when combining RTCC rollover and external event interrupt triggers because an external event interrupt can hide a rollover interrupt. But in this case, as soon as you get the external interrupt, you'll either zero the counts or stop the counting, so masking a rollover interrupt won't matter. The main program loops, waiting for the state to become "stopped", at which point it will translate the count number to milliseconds, display it, then set the state to "waiting". There are lots of details to work out - how often to have the RTCC rollover and increment the counts, how many count bytes you'd need, how counts translate to milliseconds, how to display the results, how to design and condition the event trigger signals, etc. But something like this would probably work. David ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=109000#m109054 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)