# Can't get PIC 16F876 working.What am I doing wrong?

I have been playing around with the PIC16F628 for a while, and now I want to transfer to something that has more pins. Specifically the PIC16F876, but I can't get it working. I just want to turn an LED on/off and nothing ever happens. This is my circuit:

I program my PICs in the mikroC editor and these are the settings:

• OSCILLATOR: HS
• WATCHDOG: Disabled
• POWER-UP TIMER: Disabled
• FLASH code protection: Disabled
• Brown-out reset: Enabled
• Low voltage programming: Disabled
• Flash program memory write: Enabled
• In-circuit debug: Disabled

And this is my code:

void main(){
TRISB = 0x00;
while(1){
PORTB = 0b11111111;
delay_ms(500);
PORTB = 0b00000000;
delay_ms(500);
}
}


And nothing works. I tried with 4.10 and 11 MHz oscillator values and nothing. What did I do wrong?

• I assume "nothing works" means the LED does not even lit? Did you define your clock (something like #define F_CPU 10000000L) for 10MHz? The delay works from that definition. Though, you say it is 500ms, it might be longer/shorter. Can RB7 pin deliver enough current for the LED? You might need some buffer. Did you choose the correct resistor? – Nazar Aug 6 '15 at 11:55
• Silly thought perhaps, but is the LED the right way around? – Spehro Pefhany Aug 6 '15 at 12:18
• ... Decoupling? – Dzarda Aug 6 '15 at 13:09
• Does the program compile? – DerStrom8 Aug 6 '15 at 13:20
• I tried your code with all your settings on a 16F876 and it worked perfectly - even without a decoupling capacitor. Assuming your chip is not fried, the only thing I can think of is a wiring error. – Bruce Abbott Aug 6 '15 at 21:25