am trying to generate some more efficient code from my C routines. I have found that the following type of while loop, which is hanging around until a bit is set generates about ten lines of code. while (PIR1bits.SSPIF==0); It might be worth trying while (!(SSPIF)) { } or while (!(PIR1&(1<