>The short answer is, never do bit operations on a port. >Period. Do your bit operation on a mirror byte, then >write that byte to the port. If you must violate this >rule, then tread carefully. > >Periodically refreshing a port register with a mirror >byte is a good way to insure yourself against R-M-W, >and also to insure that the port is really in the state >you think it is in. I typically ... But that does not answer the original question, which was why the R-M-W operation affects the RBIF flag. Your method still affects the RBIF flag, and may even make the symptom worse if you are refreshing the port on a regular basis during an idle loop. Jan-Erik gave a very good treatise on why any operation on the port affects the RBIF flag, which did answer the original question. About the only thing he did not point out is that this "bug" (or "feature", depending on how you look at it) limits the usefulness of the Interrupt on Port Change feature unless very careful coding practices are used. _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist