In SX Microcontrollers, SX/B Compiler and SX-Key Tool, tdg8934 wrote: That did it for me: [code] ' ------------------------------------------------- ' Subroutine / Function Code ' ------------------------------------------------- ' Use: aByte = RX_BYTE ' -- returns "aByte" from 8-byte circular buffer ' -- will wait if buffer is presently empty ' -- rxBufCnt holds byte count of receive buffer (0 to 8) FUNC RX_BYTE ASM BANK rxSerial TEST rxBufCnt ' check buffer count JZ @RX_BYTE ' wait if empty MOV W, #rxBuf ' point to tail ADD W, rxTail MOV FSR, W MOV __PARAM1, IND ' get byte at tail INC rxTail ' update tail CLRB rxTail.3 ' keep 0 to 7 DEC rxBufCnt ' update buffer count BANK 0 ENDASM [b]RETURN __PARAM1[/b] ENDFUNC [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=207526#m207735 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)