Hello, anyone here have implemented a FIFO (First In, First Out) buffer for the hardware USART of a PIC? I'm using a PIC16F877 and it does have to receive USART and put it on a buffer for later processing. How do I implement it? I think I need two variables and an array, like: USART_BUFFER[8]; // for 8 locations USART_COUNTER; // how many locations filled USART_POSITION; // the last position filled When I receive a byte, I put it on (USART_POSITION + 1) and increment USART_COUNTER. When USART_COUNTER = 8 , I generate an OVERRUN error. When USART_POSITION = 8, I make USART_POSITION = 0; This is so I don't have to waste time doing: USART_BUFFER[0] = USART_BUFFER[1]; USART_BUFFER[1] = USART_BUFFER[2]; USART_BUFFER[2] = USART_BUFFER[3]; USART_BUFFER[3] = USART_BUFFER[4]; USART_BUFFER[4] = USART_BUFFER[5]; USART_BUFFER[5] = USART_BUFFER[6]; USART_BUFFER[6] = USART_BUFFER[7]; everytime I pull a byte. Is there an smarter way? Best regards, Brusque ----------------------------------- Edson Brusque Research and Development C.I.Tronics Lighting Designers Ltda (47) 323-2685 / (47) 9993-6453 Blumenau - SC - Brazil www.citronics.com.br ----------------------------------- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics