Parallax Standard Servo Motor Problem
playinmyblues_nscc
Posts: 38
While using a Standard Servo motor I noticed that some particular combinations of commands cause the motor to strain at its limits.
Using the code from "What's a Microcontroller," Chapter 4, ACTIVITY #2: CONTROLLING POSITION WITH YOUR COMPUTER, the code given is:
FOR counter = 1 TO pulses
·· PULSOUT 14, duration
·· PAUSE 20
NEXT
The variable "pulses" is entered as an input with DEBUGIN and so is the "duration" argument. The "duration" is always within range when entered. When I changed the "PAUSE 20" command to "PAUSE 2," the motor strains. Why is that?
NOTE that the motor strains when "duration" argument is the same and the "PAUSE" command has changed as above.
Full Program:
' What's a Microcontroller - Servo Control With Debug Your Turn.bs2
' Send messages to the BASIC Stamp to control a servo using
' the Debug Terminal.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
pulses VAR Word
duration VAR Word
DO
· DEBUG CLS, "Enter number of pulses:", CR
· DEBUGIN DEC pulses
· DO
··· DEBUG "Enter pulsout duration:", CR
··· DEBUGIN DEC duration
··· IF duration < 500 THEN
····· DEBUG "Value of duration must be above 499", CR
····· PAUSE 1000
··· ENDIF
··· IF duration > 1000 THEN
····· DEBUG "Value of duration must be below 1001", CR
····· PAUSE 1000
····· ENDIF
· LOOP UNTIL duration > 499 AND duration < 1001
· DEBUG "Servo is running...", CR
· FOR counter = 1 TO pulses
··· PULSOUT 14, duration
··· PAUSE 20
· NEXT
· DEBUG "DONE"
· PAUSE 1000
LOOP
·
Using the code from "What's a Microcontroller," Chapter 4, ACTIVITY #2: CONTROLLING POSITION WITH YOUR COMPUTER, the code given is:
FOR counter = 1 TO pulses
·· PULSOUT 14, duration
·· PAUSE 20
NEXT
The variable "pulses" is entered as an input with DEBUGIN and so is the "duration" argument. The "duration" is always within range when entered. When I changed the "PAUSE 20" command to "PAUSE 2," the motor strains. Why is that?
NOTE that the motor strains when "duration" argument is the same and the "PAUSE" command has changed as above.
Full Program:
' What's a Microcontroller - Servo Control With Debug Your Turn.bs2
' Send messages to the BASIC Stamp to control a servo using
' the Debug Terminal.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
pulses VAR Word
duration VAR Word
DO
· DEBUG CLS, "Enter number of pulses:", CR
· DEBUGIN DEC pulses
· DO
··· DEBUG "Enter pulsout duration:", CR
··· DEBUGIN DEC duration
··· IF duration < 500 THEN
····· DEBUG "Value of duration must be above 499", CR
····· PAUSE 1000
··· ENDIF
··· IF duration > 1000 THEN
····· DEBUG "Value of duration must be below 1001", CR
····· PAUSE 1000
····· ENDIF
· LOOP UNTIL duration > 499 AND duration < 1001
· DEBUG "Servo is running...", CR
· FOR counter = 1 TO pulses
··· PULSOUT 14, duration
··· PAUSE 20
· NEXT
· DEBUG "DONE"
· PAUSE 1000
LOOP
·
Comments
If you send it every 2 milliseconds, you're simply sending it too often.