allowed operations inside interrupts in BASIC
Posted: Sun Feb 10, 2013 10:53 pm
>from the help line
>Can you advise whether I can still depend on times now? Thank you.
Actually string functions, PRINT is normally one of them, should not be placed
inside an interrupt routine. It can be useful to throw one in just to see if
the interrupt happens, but they are not re-entrant and the string accumulator is
not saved on entry to an interrupt.
So that is most likely your problem.
In your example, why not use the built in RTC ??
-------------------------CODE:-----------------------
sbr:
mi=mi+1
if mi=60 then
ho=ho+1
mi=0
end if
if ho=24 then
ho=0
da=da+1
end if
print da;\" \";ho;\":\";
if min>9 then print mi else print \"0\";mi
return
main:
rpt:
on timer 60000 sbr
stop
-----------------
0 0:01
0 0:02
Prefetch Abort ea64
>Can you advise whether I can still depend on times now? Thank you.
Actually string functions, PRINT is normally one of them, should not be placed
inside an interrupt routine. It can be useful to throw one in just to see if
the interrupt happens, but they are not re-entrant and the string accumulator is
not saved on entry to an interrupt.
So that is most likely your problem.
In your example, why not use the built in RTC ??
-------------------------CODE:-----------------------
sbr:
mi=mi+1
if mi=60 then
ho=ho+1
mi=0
end if
if ho=24 then
ho=0
da=da+1
end if
print da;\" \";ho;\":\";
if min>9 then print mi else print \"0\";mi
return
main:
rpt:
on timer 60000 sbr
stop
-----------------
0 0:01
0 0:02
Prefetch Abort ea64