This code works as expected - an interrupt every 0.5 secs with a sertxd on every other interrupt showing the (whole) seconds counter
but this produces no (timer) interrupts at all
Everything I see in the manual seems to suggest that SETINT and SETINTFLAGS are separate - but it doesn't explicitly say so. It appears they aren't - which is bad news for my app (concurrent elapsed timing with ON/OFF manipulation of the pin interrupts at certain times).
Ideas?
Code:
#picaxe 28x2
#no_table
#slot 0
#terminal 38400
symbol secs = b15
symbol half_sec_count = b55
setfreq em32
;interrupt every 0.5 seconds
SETTIMER t1s_16
TIMER = 65535
;interrupt on timer (flag) overflow
SETINTFLAGS %10000000,%10000000
DO
LOOP
interrupt:
SERTXD ("Interrupt...")
INC half_sec_count
IF half_sec_count = 2 THEN
INC secs
SERTXD ("...secs = ", #secs)
half_sec_count = 0
END IF
SERTXD (CR, LF)
SETTIMER t1s_16
TIMER = 65535
SETINTFLAGS %10000000,%10000000
return
Code:
#picaxe 28x2
#no_table
#slot 0
#terminal 38400
symbol secs = b15
symbol half_sec_count = b55
setfreq em32
;interrupt every 0.5 seconds
SETTIMER t1s_16
TIMER = 65535
;interrupt on timer (flag) overflow
SETINTFLAGS %10000000,%10000000
DO
;turn (pin B.0 = 1) interrupts on and off
SETINT %00000001,%00000001, B
;...in fact you don't even need this line to stop SETINTFLAGS responding
SETINT OFF
LOOP
interrupt:
SERTXD ("Interrupt...")
INC half_sec_count
IF half_sec_count = 2 THEN
INC secs
SERTXD ("...secs = ", #secs)
half_sec_count = 0
END IF
SERTXD (CR, LF)
SETTIMER t1s_16
TIMER = 65535
SETINTFLAGS %10000000,%10000000
return
Ideas?