In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote: But you seem to still skip over the RETURNINT in some cases. I am sure this would lead to unpredictable results. But if you are just counting time, why not just count time with a free running interrupt? e.g.: [code] msLed PIN RA.3 OUTPUT secLed PIN RB.4 OUTPUT flags VAR byte ' global variable isrFlag VAR flags.0 microseconds VAR Word milliseconds VAR Word seconds VAR Byte minutes VAR Byte hours VAR Byte WATCH microseconds WATCH milliseconds WATCH seconds WATCH minutes WATCH hours 'ISR INTERRUPT 1_000_000 ' every micro second, personally I would do milliseconds or maybe 100us (INTERRUPT 10_000) unless you really need micro seconds isrFlag = 1 RETURNINT Start: msLed = 0 secLed = 0 Main: IF isrFlag = 0 THEN Main isrFlag = 0 microseconds = microseconds + 1 IF microseconds >= 1000 THEN microseconds = microseconds - 1000 milliseconds = milliseconds + 1 msLed = ~msLed IF milliseconds >= 1000 THEN milliseconds = 0 seconds = seconds + 1 secLed = ~secLed IF seconds >= 60 THEN seconds = 0 minutes = minutes + 1 IF minutes >= 60 THEN minutes = 0 hours = hours + 1 ENDIF ENDIF ENDIF ENDIF GOTO Main [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=363831#m367249 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)