Thanks Nigel Duckworth wrote: > David, I searched the Microchip website using 'oerr' and came up with this; > > http://support2.microchip.com/KBSearch/KB_StdProb.aspx?ID=SQ6UJ9A001VPG > > From memory (no pun intended) RCREG is a FIFO so you might want to read > it several times to ensure it's clear > (as per my previous posted code). > > Regards, > > Nigel > > > David wrote: > >> >> This is my current code that does NOT work, every now and then the UART >> stops receiving data. >> >> >> rx_char = RCREG; >> >> if((OERR)||(FERR)) >> { >> rx_char = RCREG; >> TXEN = false; >> TXEN = true; >> CREN = false; >> CREN = true; >> COM1.State = IDLE; >> } >> else GetComByte(rx_char); >> >> >> >> >> Alan B. Pearce wrote: >> >> >>>> In summary, I need to now the right way to handle com errors >>>> when using receive interrupts so that the UART cannot get into >>>> a state where it does not receive when RCIE is set and RCIF >>>> has been cleared. >>>> >>>> >>>> >>> You have to reset the UART after an error. This sis explicitly mentioned in >>> the datasheet IIRC. >>> >>> >>> >>> > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist