In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: 1. This is a trick I learned from PJV, one of the aforementioned gurus. Here's the deal: the interrupt runs at a known rate so we can use that rate for external timing. This is important because time-based functions like PAUSE get hosed up when we use interrupts. This is why -- as in this program -- when we're using an interrupt the code inside DELAY_MS changes; in this case it simply counts interrupt cycles which are marked by setting the isrFlag to 1. In your program the interrupt rate is conveniently set to 1 millisecond so DELAY_MS is very straightforward: it clears the flag, waits for another, and then decrements the delay (millisecond) counter until it reaches zero. In the end, setting isrFlag to 1 is way to tell the foreground the the ISR has run. 2. There are two ways to insert Assembly statements into an SX/B program: the \ character allows for a single line, or we can put in a block of statements using ASM..ENDASM. For one or two lines I tend to use \, for more than that I usually have an ASM..ENDASM block. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=291162#m291327 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)