Hi
I have set up 08m2 as a timer for the baitlauncher...works fine,magnet over the hall effect moves thru 3 stages and sets the timer at that stage when I remove the magnet..that bits works..
but I have a reed switch to interrupt so I can stop the thing if I need to ..but i cant interrupt once the timer starts, only when its waiting..
My question:can I interrupt this code on the 08m2 ? Any help is appreciated. Steve
I have set up 08m2 as a timer for the baitlauncher...works fine,magnet over the hall effect moves thru 3 stages and sets the timer at that stage when I remove the magnet..that bits works..
but I have a reed switch to interrupt so I can stop the thing if I need to ..but i cant interrupt once the timer starts, only when its waiting..
My question:can I interrupt this code on the 08m2 ? Any help is appreciated. Steve
Code:
setint %00001000, %00001000,c
main:
sertxd ("back at main ",13,10)
pause 50
high c.4
pause 50
low c.4
pause 50
high c.4
pause 50
low c.4
pause 50
high c.4
pause 50
low c.4
pause 50
high c.4
pause 50
low c.4
pause 50
wait 1
sertxd ("reading hall sensor in main",13,10)
readadc C.1,b0 ; read ADC1 into variable b0
sertxd("The value of b0 is ",#b0,13,10)
if b0 > 150 then fxtimerreadyA ;
if b0 < 150 then goto main ;
goto main
fxtimerreadyA: 'where if you remove magnet fxtimerA will activate but keep it and move to fxtimerreadyB
for b0 = 1 to 5 'use b0 variable memory space for a loop flash 5 times
high C.4 'output pin B.5 on
pause 250
low C.4
pause 250
next b0
sertxd ("reading hall sensor in fxtimerreadyA",13,10)
readadc C.1,b0 ; read ADC1 into variable b0
sertxd("The value of b0 is ",#b0,13,10)
if b0 > 150 then fxtimerreadyB
if b0 < 150 then goto fxtimerA
fxtimerA: 'the first timer programme
sertxd ("in fxtimerA mode ",13,10)
high c.4
high c.2
for b1 = 1 to 10 ; 10 loops
pause 60000 ; wait 60 seconds
next b1
wait 1
low c.4
low c.2
sertxd ("finished timer ",13,10)
pause 500
goto main 'go back to main
fxtimerreadyB: 'where if you remove magnet fxtimerB will activate
sertxd ("in fxtimerreadyB ",13,10)
for b3 = 1 to 5 'loop the LED
high C.4
pause 500
low C.4
pause 500
next b3
sertxd ("reading hall sensor in fxtimerreadyB",13,10)
readadc C.1,b0 ; read ADC1 into variable b0
sertxd("The value of b0 is ",#b0,13,10)
if b0 > 150 then fxtimerreadyC
if b0 < 150 then goto fxtimerB
fxtimerB:
sertxd ("in fxtimerb ",13,10)
high c.4
high c.2
for b1 = 1 to 20 ; 25 loops
pause 60000 ; wait 60 seconds
next b1
wait 1
low c.4
low c.2
sertxd ("finished timer ",13,10)
wait 1
goto main
fxtimerreadyC:
sertxd ("in fxtimerreadyc ",13,10)
for b5 = 1 to 5 'use variable b5 to loop LED
high C.4
pause 1000
low C.4
pause 1000
next b5
sertxd ("reading hall sensor in fxtimerreadyC",13,10)
readadc C.1,b0 ; read ADC1 into variable b0
sertxd("The value of b0 is ",#b0,13,10)
if b0 > 150 then goto main
if b0 < 150 then goto fxtimerC
fxtimerC:
sertxd ("in fxtimerc ",13,10)
high c.4
high c.2
for b1 = 1 to 25 ; 25 loops
pause 60000 ; wait 60 seconds
next b1
wait 1
low c.4
low c.2
sertxd ("finished timer ",13,10)
pause 500
wait 1
goto main
interrupt:
sertxd ("interrupting ",13,10)
if pin3 = 1 then interrupt 'if reed switch on pin3 is high(on)
low C.2
low c.4
wait 2
setint %00001000, %00001000
goto main