Nick Hale wrote: > I also thought that I had quoted the relevant parts. There was nothing above the line I quoted. > I am writing a program which receives serial data and manipulates > portb depending on what is received. The pic uses RA6=low to signal > that it is ready to receive the next data byte. > > The interrupt handler raises RA6 when a byte is received, the main > loop checks the UARTs 'transmission received' flag (PIR,5). This > flag never seems to get set. If I raise a flag in the interrupt > handler, then it works ok, but why doesn't checking PIR,5 work? >From the sounds of it, because the interrupt routine has cleared it. If it didn't, you would be in a infinite interrupt loop. Hmm, how do you know you're not? The symptom would be that the foreground code would just stall. > If i include the code, would that be helpful? Show the interrupt service routine. > The main loop waits for a byte to be received*. Once this happens, > it can read the byte out of RCREG and then set RA6=low. This lets > the sender know that it can send another byte if it wants. the pic > then goes off and manipulates portb, which involves delays and things. > > When a byte is received, the interrupt handler This isn't adding up. What is the interrupt handler interrupting on? It sounds like RCIF. But if you are taking a interrupt on RCIF then the interrupt routine will have to clear by reading RCREG to avoid infinite interrupts. If it does, the foreground code won't see it set. If it doesn't you get infinite interrupts. > sets RA6=high, to > signal to the sender not to send anything else until the main loop is > ready for it. What is the other device? If it's a PC, then you need a 16 byte or so FIFO. They don't instantly stop sending on CTS. It sounds like you want interrupt driven UART input anyway. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist