ISR lockup
Posted: 08 July 2008, 12:53 PM
The following code fragments seem to correctly set up an INT0 ISR:
loopTogglePin follows the pulsetrain (250 Hz) fairly well, but after several seconds, fails to do so and flatlines.
Here is what the program's debug output looks like:
Nothing else is running except for an infinite sleep loop. but clearly I'm getting some sort of reset or lockup (stack issues, etc.). Anyone have thoughts on how to debug this?
Code: Select all
'~~~~~~~~ INTERRUPTS ~~~~~~~~~
Register.EICRA = Bx0101_0101 '0101_0101 = any edge of INT0,1,2,3
Register.EICRB = Bx0101_0101 'any edge of INT4,5,6,7
Register.EIMSK = Bx0000_0001 'enable INT0
const INT_MASK as byte = Bx1000_0000
Register.SREG = Register.SREG Or INT_MASK 'enable interrupts
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code: Select all
ISR INT0()
'test of manual ISRs
putpin loopTogglePin, zxOutputToggle
'debug.print "0"
're-enable interrupts:
#asm
reti
#endasm
End ISR
loopTogglePin follows the pulsetrain (250 Hz) fairly well, but after several seconds, fails to do so and flatlines.
Here is what the program's debug output looks like:
Code: Select all
ZBasiZBaZBZBaZBZBaZBasic v2.5.2
ZBaZBZBaZBasic v2.5.2
ZBaZBasic ZBaZBZBZBaZBZBaZBZBaZBasic ZBaZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBasic v2.5.2
ZBasiZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBasiZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBZBaZBasic v2.5.2ZBZBasic�ZBaZBZBaZBZBaZBZBaZBasic v2.5.2