we are having problems with our interrupt program for the servos!!
at the moment in doesn't jump straight to the command
it goes through each line of the code and then jumps to a certain condition.
I want to intterupt straight a way.
my code is:
-----------------------------------------------------------------------
setint %00000001,%00000001
setint %00000010,%00000010
setint %00000100,%00000100
setint %00001000,%00001000
main:
servopos 0,150 ‘ move servo to one end
servopos 1,150 ‘ move servo to one end
pause 2000 ‘ wait 2 seconds
goto main
interrupt:
if pin0 = 1 then Fwd
if pin1 = 1 then Rig
if pin2 = 1 then Lef
if pin3 = 1 then Bck
Fwd:
servopos 0,180 ‘ move servo to one end
servopos 1,180 ‘ move servo to one end
'if pin0 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000010,%00000010
goto main
Rig:
servopos 0,180 ‘ move servo to one end
servopos 1,120 ‘ move servo to one end
'if pin1 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000100,%00000100
goto main
Lef:
servopos 0,120 ‘ move servo to one end
servopos 1,180 ‘ move servo to one end
'if pin2 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00001000,%00001000
goto main
Bck:
servopos 0,120 ‘ move servo to one end
servopos 1,120 ‘ move servo to one end
'if pin3 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000001,%00000001
goto main
--------------------------------------------------------------------------
does anyone know what we are doing wrong??
Many thanks
at the moment in doesn't jump straight to the command
it goes through each line of the code and then jumps to a certain condition.
I want to intterupt straight a way.
my code is:
-----------------------------------------------------------------------
setint %00000001,%00000001
setint %00000010,%00000010
setint %00000100,%00000100
setint %00001000,%00001000
main:
servopos 0,150 ‘ move servo to one end
servopos 1,150 ‘ move servo to one end
pause 2000 ‘ wait 2 seconds
goto main
interrupt:
if pin0 = 1 then Fwd
if pin1 = 1 then Rig
if pin2 = 1 then Lef
if pin3 = 1 then Bck
Fwd:
servopos 0,180 ‘ move servo to one end
servopos 1,180 ‘ move servo to one end
'if pin0 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000010,%00000010
goto main
Rig:
servopos 0,180 ‘ move servo to one end
servopos 1,120 ‘ move servo to one end
'if pin1 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000100,%00000100
goto main
Lef:
servopos 0,120 ‘ move servo to one end
servopos 1,180 ‘ move servo to one end
'if pin2 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00001000,%00001000
goto main
Bck:
servopos 0,120 ‘ move servo to one end
servopos 1,120 ‘ move servo to one end
'if pin3 = 1 then interrupt
pause 2000 ‘ wait 2 seconds
setint %00000001,%00000001
goto main
--------------------------------------------------------------------------
does anyone know what we are doing wrong??
Many thanks