>> 8) Remember the read-modify-write thing. Reading another port pin can stuff >> up your i2c. > Does number 8 apply when you're changing the TRIS register, as opposed to the > actual data register? Sorry. I was in a hurry at the time, otherwise I would have expanded on it. Yes. It's a gotcha for when you are pin bashing I2C using the TRIS register. You write a 0 into the data latch and then swap the pin between input and output using the TRIS register. When it's an output, it's outputting a 0. When it's an input, the external pullup makes the bus a 1, also allowing other things on the bus to pull it low if needed. This bit you know. The catch is when you execute an instruction that does a read-modify-write on another port bit. It reads the port as a byte (reading the pins) gets the bit it needs and then writes the data byte back to the port (latches). If your bus was idle at the time, the read gets a 1 from the bus and writes it into the data latch. You wanted the 0 that you originally wrote. If you don't fix it when you start to use the bus properly, you don't get any 0's on the bus. If you have an interrupt that can occur while you are using the i2c bus and it tests a bit on the port, you'll pull out a lot of hair. BTW. This isn't a problem particular to PICs. Steve. ====================================================== Very funny Scotty. Now beam down my clothes. ====================================================== Steve Baldwin Electronic Product Design TLA Microsystems Ltd Microcontroller Specialists PO Box 15-680 email: steveb@kcbbs.gen.nz New Lynn, Auckland ph +64 9 820-2221 New Zealand fax +64 9 820-1929 ======================================================