My latest fifo code uses counters instead of doing address comparisons. So, I set aside the following ram: BytesInBuf BytesFreeInBuf InputWrapCounter OutputWrapCounter I also have input and output pointers that get moved into an FSR when we're sticking stuff into the fifo or taking stuff out. Initialization clears BytesInBuf and sets BytesFreeInBuf to the size of the buffer. Both wrap counters are set to the size of the buffer. Input and output pointers are set to the first address of the buffer. When putting a byte in the buffer, the InputPointer is put in FSR, the data byte is put in the buffer using INDF with auto increment, the updated pointer is copied from FSR to RAM. BytesInBuf is incremented. BytesFreeInBuf is decremented. InputWrapCounter is decremented. If it hit zero, the InputPointer is set back to the address of the start of the buffer, and the InputWrapCounter is set back to the size of the buffer. A similar routine takes stuff out of the buffer. Routines interacting with the fifo can check BytesInBuf and BytesFreeInBuf before they use the fifo, knowing whether there's any data to take, or room for more data. 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