I have been running some code under the MPLAB debugger with the Junebug. I was trying to teach myself how to use interrupts, mainly from the 18F1320 datasheet rather than code online. Although slow, the debugger is pretty neat, even if the one breakpoint limit sucks.
I spent a while going crazy though as my breakpoint in the ISR didn't ever hit. I read something vague online that suggested interrupts don't fire if using debug mode. Is this correct?
The same code with GIE and TMR0IE disabled and a simple test of the overflow flag works and provides a delay. The LED macro is from the Junebug manual.
I have disabled the code that I used to setup the interrupts and removed the code at org 0x04 which I presumed would handle the interrupt. If anybody can spot anything wrong with what I did, please say.
I spent a while going crazy though as my breakpoint in the ISR didn't ever hit. I read something vague online that suggested interrupts don't fire if using debug mode. Is this correct?
The same code with GIE and TMR0IE disabled and a simple test of the overflow flag works and provides a delay. The LED macro is from the Junebug manual.
I have disabled the code that I used to setup the interrupts and removed the code at org 0x04 which I presumed would handle the interrupt. If anybody can spot anything wrong with what I did, please say.
Code:
Start bcf T0CON, TMR0ON
; bcf INTCON, TMR0IE
movlw b'01000101'
movwf T0CON ; Enable Timer0
clrf TMR0L
clrf TMR0H
bcf INTCON, TMR0IF ; Clear Timer0 flag
; bsf INTCON, TMR0IE ; Enable Timer0 interrupt
; bsf INTCON, GIE ; Enable global interrupts
bsf T0CON, TMR0ON
bsf ADCON1, 0 ; Digital IO, disable A/D
LED1 LED b'00000001', b'10111110'
Loop btfss INTCON, TMR0IF
goto Loop
movlw b'0000001'
xorwf LATA
bcf INTCON, TMR0IF
goto Loop