Hi Sairam, There are several potential problems I see here: 1) Did you use a current-limiting resistor for the LED? You should use one to limit the current to about 10mA or so. 2) Is there something connected to the other 7 pins of PORTB? 3) The code you used to write to the bits of PORTB may have a read-modify-write operation which is causing the pin change to fail. This means that you may be setting the 8th pin to one level (for example, high), but then you perform another operation on PORTB which reads the pin states, modifies them, and writes them back. If the 8th pin has not had a chance to finish transitioning, or if the LED is pulling the pin to the opposite level, then this read-modify-write operation may be setting the 8th pin back to the value it reads from it, which would negate what you are trying to do. Example: at the start, PORTB=3D0x00 bsf PORTB,7 (read PORTB, get 0x00, set the last bit of this result high, yielding 0x80, then output to PORTB. The 8th pin begins to rise) bsf PORTB,6 (this reads PORTB, but since the 8th pin has not had a chance to finish rising yet, the result is still 0x00. This instruction then sets the 6th bit, yielding 0x40, and then outputs 0x40 to PORTB. This forces the 8th pin back down to 0). 4) Are you sure your code is setting the LED's pin on PORTB to an output? As for the delay routine, I am not familiar with the HiTech C libraries, so perhaps someone else can help you there. What do you mean by "unstable"? Do you mean that it doesn't always give the same delay length? If so, perhaps you have interrupts enabled and they are interfering with the timing of your main code. Sean On Sun, Dec 20, 2009 at 9:52 PM, yamanoor sairam wr= ote: > Dear All, > =A0 =A0 =A0 I was helping someone to learn PIC Microcontrollers with a LE= D blinking program using a new PIC16F877A board. The LED was connected to t= he 8th pin of PORTB. I switched (on and off) all the eight pins of PORTB. T= he LED didn't glow. > > I tried switching on the eight pin alone. It worked. I realised from the = datasheet that all the eight pins of PORTB sinks 200mA of current. In order= to make an array of LED's to glow, should I use BC 547 transistors? > > The board uses a 11MhZ crystal. I see that the delay code that I download= ed from the HiTech C libraries is not functioning properly. The delay code = seems to be unstable. How do I develop a perfect delay code for myself? I d= efined the clock frequency of my crystal in my code. But the delay seems to= be erratic. > > Regards, > Sairam > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist