Slight update. It is RB5/PGM and not RB4 that crasches the program if it floats. Any LED connected to it is off all the time, when the rest of the LEDS on port B cycles repeatedly. Generally its a bad idea to leave pins floating, but this one is set as output so it shouldnt make the PIC restart, right? /PJ // This is example 1 from "Getting Started with MPLAB C18" #include /* for TRISB and PORTB declarations */ #include /* for 'Delay10KTCYx' */ int counter; int LEDout; void main (void) { TRISB = 0; /* configure PORTB for output */ TRISD = 0; /* configure PORTD for output */ PORTB = 0; /* set all 8-bits low */ counter = 1; LEDout=0; PORTB = LEDout; // display value of 'counter' on the LEDs Delay10KTCYx (255); // pause for a moment (255 * 10,000 cycles) Delay10KTCYx (255); // pause for a moment (255 * 10,000 cycles) Delay10KTCYx (255); // pause for a moment (255 * 10,000 cycles) while(1) { while (counter <= 8) { if (counter>=1) LEDout=1; if (counter>=2) LEDout=2; if (counter>=3) LEDout=4; if (counter>=4) LEDout=8; if (counter>=5) LEDout=16; if (counter>=6) LEDout=32; //<-this is where it fails if (counter>=7) LEDout=64; if (counter>=8) LEDout=128; PORTB = LEDout; // display value of 'counter' on the LEDs Delay10KTCYx (255); // pause for a moment (255 * 10,000 cycles) counter++; } counter = 1; // reset counter for for next cycle } // END-LOOP: while(1); } -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.