Hi there,
There are couple of things you did not specify in your code.
1. You set your OSC to be 8Mhz (internal OSC) but you are declaring it to PBP as 20Mhz. Are you using internal OSC or external OSC?
2. Since you did not enable internal weak pull ups on PORTB pins, I assume you are using external pull up resistors on your input buttons. If you are not using any, then input pins may behave like crazy.
3. This chip has analog port on PORTA. You have a speaker on PORTA.0 but you did not disable analog module.
4. "If Power_LED = 1 ..." this won't work. You can not read the state of an output pin. I suggest that you set a flag bit and read that flag instead.
===============================
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks