> I'm taking an existing circuit board from the 16C67 to the 16F877. > Everything seems to work normally except for a bit-banging routine > ... > To make matters more confusing, this problem only occurs with > burned chips, and does not occur on the MPLAB ICE. This is probably not a programming bug. The main difference between the ICE and a real chip is the capacitance on the lines. This can effect an improperly designed oscillator and any lines that are floating or have passive pullups/pulldowns. I had a problem once where an IIC bus between two PICs that worked fine when either chip was replaced with the ICE, but failed when both were real chips. It turned out the extra capacitance from the ICE made the system work. I don't know how this relates to your RS-232 problem, but maybe the RS-232 is fine but getting hit with an unexpected interrupt somewhere? I'd like to know what this is when you find it. > bsf ADCON1, PCFG2 ; the F877 automaitically configures > bsf ADCON1, PCFG1 ; certain pins as AtoD. This makes all the pins > digital. Yes, this is a real gotcha and a dumb choice of defaults by Microchip. > clrf PIR2 ; added for 877 > clrf ADCON0 > > page_2 ; added for 877 > clrf p2_EEDATA > clrf p2_EEADR > clrf p2_EEDATH > clrf p2_EEADRH > > page_3 ; added for 877 > clrf p3_EECON1 ; disables writes to onboard EEPROM > clrf p3_EECON2 This is a waste of time. Except for the A/D, all the extra stuff wakes up so that it won't bother you if you don't touch it. I noticed that you trusted the PCFG3 bit in ACCON1 to wake up 0, so why is the rest of this stuff any different? ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.