I have a problem with a circuit which I have designed and constructed, using a PIC16F867. PORT A bit 4 is behaving erratically during single bit writes to other bits of port A All other I/O appears to be working well. Port A bit 4 is a bi-directional input or output, as a schmitt trigger when used as an input, and an open collector output. It may also be used as the external clock input for TIMER 0. If my program is run under Microchip's simulator MPLABSIM, the watch window shows bit 4 of port A correctly following the program instructions when writing to that bit, and not affected by writing to other bits. When my program is run under the debugger ICD2, or when programmed into my system and run in stand-alone mode, bit 4 behaves erratically. Writing a high to bit 4 will set its output pin high but subsequent single bit writes ( either a 1 or 0 ) to port A bit 2 or bit 5 will turn bit 4 off again. Under ICD2, the watch window always shows bit 4 as 0 regardless of any 1's being written to it, and even whilst the LED is lit. By comparison the watch window accurately follows any changes arising from writing to bit 5. I have not fully investigated the effect of writing to bit 2, other than to note that it also interferes with bit 4. I have checked my program for correct initialisation, including the setup of port A, which is done using Microchip's suggested initialisation as in the data book, and have not found any errors.Replacing the PIC16F876, with another one of the same type,does not solve the problem Can anyone tell me how to get bit 4 responding properly? Regards Harry Pfeifer -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist