---------- Post added at 03:21 ---------- Previous post was at 02:44 ----------
Same problem with a 1K. Does a 5mm LED really draw all of the current out of a 9V battery?!
9V battery is around 500mAHr so new one should put out 30mA for around 16 or 17 hrs. And I am sure that 9V battery can source more than 30mA. So no.
At 1kohm that would be 167hrs. But that is only the LED not the rest of the circuit. How much current is the pic draining?
Have you used a multimeter to see what is actually going on?
Debugging with an LED is not very effective, you need to measure actual voltages and currents to see why the circuit is failing.
Measure the actual 9v battery output.
Measure he 7805 output.
Measure the output of the PIC that the LED is connected to. Is that where the LED is connected to?
Measure the voltage across the resistor or LED.
Measure the current in to the PIC Vcc.
Measure the current out of the 9V battery.
After you measure then you can see easily what it happening.
I suggest you use a 9V regulator for the purpose of testing the circuit so you don't waste money on batteries.
Then when the circuit is working and you are confident that the circuit is not draining too much current, then try with the 9V battery. Unless of course you
are using rechargeables.