Got a few problems there ...
For Interrupt on change with RA5, you need to set bit 5 of the IOCA register. You have bit 7 set.Then the PortA change interrupt needs to be enabled (RAIE)...In the interrupt handler (buttonpressed), you MUST read PORTA to end the mismatch condition, and clear the interrupt flag before exiting the handler. And it must exit the handler. You have a continuous loop in there, remove the goto.
Code:
buttonpressed:
gosub All_on:
dummy = PORTA ; clear mismatch condition
INTCON.0 = 0 ; reset interrupt flag
resume
Keep in mind that you will get an interrupt on both the Press and Release of the button. You will eventually need to change the interrupt handler to determine which Edge occurred.
RA5 is also a main oscillator pin. I assume you are using the internal oscillator .. just checking.
You should turn off the Analog functions when using Digital signals.And disable the comparators.
Bookmarks