philtep
- 20th September 2005, 21:18
Hello all,
I'm having an issue gettings the On Interrupt GoTo command to work.
I've tried the following:
DEFINE OSC 20
led var PORTA.2
INTCON2.6 = 1 ' Enable PORTB pullups
INTCON2.7 = 1
On Interrupt Goto myint ' Define interrupt handler
INTCON = $90 ' Enable INTE interrupt
loop: High led ' Turn LED on
Goto loop ' Do it forever
' Interrupt handler
Disable ' No interrupts past this point
myint: Low led ' If we get here, turn LED off
Pause 500 ' Wait .5 seconds
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
This is the PicBasic Pro example slightly modified for the PIC18.
It doesn't run the myint.
I've done other tests to where I monitor the value of INTCON on an LCD and the register IS getting triggered because INTCON.6 = 1 after I trigger the interrupt. Regardless tho, it doesn't execute the myint label.
Is there anything I'm doing wrong? Any specific config changes I need to get PBP to compile it correctly maybe?
Any help is greatly appreciated,
Thanks,
Philip
I'm having an issue gettings the On Interrupt GoTo command to work.
I've tried the following:
DEFINE OSC 20
led var PORTA.2
INTCON2.6 = 1 ' Enable PORTB pullups
INTCON2.7 = 1
On Interrupt Goto myint ' Define interrupt handler
INTCON = $90 ' Enable INTE interrupt
loop: High led ' Turn LED on
Goto loop ' Do it forever
' Interrupt handler
Disable ' No interrupts past this point
myint: Low led ' If we get here, turn LED off
Pause 500 ' Wait .5 seconds
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
This is the PicBasic Pro example slightly modified for the PIC18.
It doesn't run the myint.
I've done other tests to where I monitor the value of INTCON on an LCD and the register IS getting triggered because INTCON.6 = 1 after I trigger the interrupt. Regardless tho, it doesn't execute the myint label.
Is there anything I'm doing wrong? Any specific config changes I need to get PBP to compile it correctly maybe?
Any help is greatly appreciated,
Thanks,
Philip