Regarding overwriting the buffer with new data when using a static buffer. What I do currently is something along the lines of this: void processCommands() { char tmpBuf[SERIAL_BUFFER_SIZE + 1]; RCIE =3D 0; memcpy(tmpBuf, __serial.buf, SERIAL_BUFFER_SIZE + 1); // buffer includes a "silent" extra byte to ensure a 0 terminator is always available RCIE =3D 1; .. process tmpBu .. } Though the fifo seems a better option since you don't have to disable the interrupt even for a moment. The only down side is the extra overhead of comparing the pointers to check for a wrap around, since I would still need to copy it into another buffer for the string comparisons when finding a command. Though it's a minor overhead given the large benefits for an asynchronous protocol. Quintin Beukes On Fri, Oct 9, 2009 at 10:20 PM, Quintin Beukes wrote: > Thanks again. > > Funny enough about an hour before I sent this e-mail I was > contemplating alternatives. The head/tail index was actually something > I though up there (though I was thinking pointers it's technically the > same thing). > > Quintin Beukes > > > > On Fri, Oct 9, 2009 at 9:11 PM, Harold Hallikainen > wrote: >> >>> Quintin Beukes wrote: >>>> Re. your FIFO tip? How do you implement this fifo? >>> >>> My PIC development environment (http://www.embedinc.com/pic) includes >>> template modules for interrupt driven UART I/O with FIFOs. =A0The app c= alls >>> UART_PUT and UART_GET to send and receive bytes. =A0These routines acce= ss >>> the >>> transmit and receive FIFOs, with the interrupt routine doing the work of >>> accessing the UART hardware. =A0In a lot of cases you don't really need= a >>> output FIFO, and you can change UART_PUT to spin on TXIF then write to >>> TXREG. >> >> There was also an extensive discussion of this in July. See >> http://www.nabble.com/Task-scheduling-in-Embedded-Systems-to24735436.htm= l#a24768292 >> >> Harold >> >> >> -- >> FCC Rules Updated Daily at http://www.hallikainen.com - Advertising >> opportunities available! >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist