Hi, OK, basically, the program 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. Initially, RA6 is low. 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 sets RA6=high, to signal to the sender not to send anything else until the main loop is ready for it. * if the main loop detects a byte having arrived by checking a flag set in the interrupt handler, it works. if the main loop detects a byte having arrived by looking at PIR,5 it doesn't work. I don't understand why it doesn't pick up on PIR,5 being set Nick 2009/2/8 Olin Lathrop > Nick Hale wrote: > > yeah, sorry, RA6 is an output, but i was using it as in internal flag > > too. just tried with a normal flag which isn't an output pin and it > > seems to work. > > Using a port register bit as a internal flag can be dangerous if you don't > fully understand and consider the read-modify-write issue. > > > This leads me to a further question... Why can't I just check UARTs > > own 'transfer complete' flag (PIR,5)? > > I don't know. That depends on what you are trying to do, which is not > clear. > > > ******************************************************************** > 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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist