In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: Bean is right, you shouldn't count on them being global. Since the NOPRESERVE option is used instead of NOCODE there is a BANK 0 instruction inserted at the head of the ISR so this works fine for the program as it is. Yes, you can move the tix timer to the serial bank, but there are implications: you can't declare a word in the array so you have to declare two bytes; tix_LSB and tix_MSB. Then update the top of the ISR like this: [code]Check_Timer: ASM BANK serial CJA tix_MSB, #0, Check_Timer_Done CJA tix_LSB, #0, Check_Timer_Done Update_Timer: SUB tix_LSB, #1 SUBB tix_MSB, /C Check_Timer_Done: BANK 0 ENDASM[/code] This replaces the SX/B code that was there (it's actually a small modification of the compiler output). Then you have to adjust the DELAY_MS subroutine: [code]' Use: WAIT_MS mSecs WAIT_MS: IF __PARAMCNT = 1 THEN tmpW1 = __PARAM1 ' get byte parameter ELSE tmpW1 = __WPARAM12 ' get word parameter ENDIF DO WHILE tmpW1 > 0 tix_MSB = 0 tix_LSB = 230 MS_Hold: IF tix_LSB > 0 THEN MS_Hold ' is tix zero? IF tix_MSB > 0 THEN MS_Hold DEC tmpW1 ' yes LOOP RETURN[/code] This routine could be optimized so that you're only using a byte; the word was used so that you could create custom delays based on ISR ticks elsewhere in the program. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=179709#m179861 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)