In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jon Williams wrote: Here's what I would do to create a 20-byte column buffer: colBufLo VAR Byte (16) ' define 20-byte array colBufHi VAR Byte (4) I would also define a separate column and buffer index pointers: colPntr VAR Byte bufIdx VAR Byte Now the ISR is a can handle the code pretty cleanly: ' --------------------------- INTERRUPT ' --------------------------- ISR_Start: LEDs = %00000000 ' blank outputs to prevent ghosting INC colPntr ' update column pointer IF colPntr = 20 THEN ' roll-over if at end colPntr = 0 ENDIF IF colPntr.4 = 0 THEN ' in low portion of buffer? idx = colPntr & %00001111 ' calculate buffer index LEDs = colBufLo(bufIdx) ' output current column ELSE idx = colPntr & %00000011 LEDs = colBufHi(bufIdx) ENDIF ISR_Exit: RETURNINT 63 Note that if you use a 32-byte buffer then you can simplify the buffer pointer manipulation (with roll-over) like this: INC colPntr colPntr.5 = 0 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=97747#m97942 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)