Resetting Problem
Hi, my code is resetting everytime i transition my servos from forward to reverse.· I have 2 parallax continuous rotation servos for the drive wheels.· I'm using a BoE Rev C and I recently upgraded my chip to a BS2sx.· The code worked fine with the old chip, a BS2.· However, now anytime my robot changes from forward to reverse or viceversa it is causing my program to reset.· I know it is resetting because it re-initializes my variables at the top of the program.· In addition, when i operate my program in position 1 (when the servos are off) the program works as it should.· It only resets when it is in position 2 and the servos are on.· Here is a quick sample code to illustrate where it resets:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
counter······· VAR··· Word
testVariable· VAR···· Byte
testVariable = 0
· FOR counter = 1 TO 100
··· PULSOUT 12, 2275
··· PULSOUT 13, 1502
··· PAUSE 10
··· testVariable = 1
· NEXT
· DO
····PULSOUT 12, 1500
··· PULSOUT 13, 2273
··· PAUSE 10
· LOOP
END
With this code, the robot goes forward for the FOR loop, when it gets to the pulses in the DO loop it resets to the top of the program.· Initializes testVariable to 0 and starts the FOR loop again.· It never gets to the infinite DO Loop.· I would greatly appreciate any help with this,· I have no idea why the program would reset.
' {$STAMP BS2sx}
' {$PBASIC 2.5}
counter······· VAR··· Word
testVariable· VAR···· Byte
testVariable = 0
· FOR counter = 1 TO 100
··· PULSOUT 12, 2275
··· PULSOUT 13, 1502
··· PAUSE 10
··· testVariable = 1
· NEXT
· DO
····PULSOUT 12, 1500
··· PULSOUT 13, 2273
··· PAUSE 10
· LOOP
END
With this code, the robot goes forward for the FOR loop, when it gets to the pulses in the DO loop it resets to the top of the program.· Initializes testVariable to 0 and starts the FOR loop again.· It never gets to the infinite DO Loop.· I would greatly appreciate any help with this,· I have no idea why the program would reset.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
As for powering the servos from higher voltages.· They're rated at 6V.· Anything higher than that and you are reducing the life of the servo.· Once you pass 9V you risk popping the capacitor inside the servo and destroying them.· I would never recommend going above 7.2V.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com