In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Okay so now your checking a variable instead of RTCC. How are you going to make sure the variable has reached zero ? Maybe like this: TEST counter JNZ $-1 Okay so let's say the counter is 1, and the interrupt occurs right after the TEST instruction. It's going to be another 7 cycles until you get out of the loop. Now let's say the counter is 1 and the interrupt occurs right before the TEST instruction. It's going to be another 3 cycles until your out of the loop. So there will still be 4 cycles of "play". Plus you have to figure in the cycles used for the interrupt call and return. The problem is NOT setting a variable at the proper time. The problem is in the looping to wait for that variable. You could just use RTCC and set it for -159 and wait for RTCC to reach zero the same way as your interrupt routine. There may be a way around this, but I think an interrupt driven video generation method is best. Interrupts are completely deterministic on the SX. Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=112331#m112466 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)