In PIC16F872, Port A pin 4 is the open drain pin and is used to control an LED. As you know, the conventional arrangement (connected to ground through the LED and a series 330 ohm resistor) does not work. Instead, I have this pin connected to 5V through the LED and series 330 ohm resistor. I set TRISA4=0 (output mode, low impedance, high current) to turn on the LED and TRISA4=1 (input, high impedance, low current) to turn off the LED. I have found that the LED sometimes won't light even with TRIS4=0. Fortunately, (after much frustration) I have been able to resolve this problem by setting RA4=0. Why is setting RA4=0 necessary for turning on the LED? I see on the datasheet that the RA4 pin also doubles as the T0CKI pin and can be a Schmitt Trigger input as well as an open drain output. I think this has something to do with what I have observed, but I'm not sure what. One strange thing is that this issue never came up when I used the PIC16F72 microcontroller. Even stranger is the fact that this issue never came up when I used the very same microcontroller and circuit to run a different program. -- Jason Hsu http://www.jasonhsu.com/swrwatt.html http://www.jasonhsu.com/swrwatt-c.txt http://www.jasonhsu.com/swrwatt-asm.txt -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist