Parallax Continuous Rotation Servo Manual Download Page 7

Copyright © Parallax Inc.

 

 

Parallax Continuous Rotation Servo (#900-00008) 

v2.2  10/24/2011  Page 7 of 8 

 
FOR counter = 1 TO 100      ' Hold still for ~3 seconds 
 
  PULSOUT servoPin, 750 
  PAUSE 20 
 
NEXT 
 
FOR counter = 1 TO 100      ' Rotate clockwise for ~3 seconds 
 
  PULSOUT servoPin, 650 
  PAUSE 20 
 
NEXT 
 
END 
 

For  more examples with  the  BASIC Stamp 2, incl uding  2-wheeled  robot maneuvers and  ramping,  see 

Robotics  with  the Boe -Bot  Chapter 4 ,  available  for free downl oad  from  the  28132 product page at 

www.parallax.com

 

Propeller

 P8X32A Application 

The program below uses counter modules to rotate the servo first clockwise at full speed for 2 seconds, 

then rests for 2 seconds, and rotates counterclockwise at full speed for another 2 seconds.  This code can 

also be downloaded from the 900-00008 product page. 

 

{{ ServoContinuousRotation.spin 
Turn Parallax Continuous Rotation Servo clockwise full speed for 21 sec. 
hold still 2 sec, and then counterclockwise full speed for 2 sec. }} 
 
CON 
_clkmode = xtal1 + pll16x                ' System clock 

 80 MHz                       

_xinfreq = 5_000_000                     ' Using 5 MHz external crystal oscillator       
servoPin = 0                             ' Servo signal to this I/O pin-change if needed 
 
PUB CenterServo | tInc, tc, tCtr, tCw, tCcw, t 
 
ctra[30..26] := %00100                   ' Configure Counter A to NCO 
ctra[8..0] := servoPin 
 
frqa := 1 
dira[servoPin]~~ 
 
 
tInc := clkfreq/1_000_000                ' 1 

μ

s increment   

tC   := tInc * 21_500                    ' Low pulse 
tCtr := tInc * 1500                      ' Center pulse = 1.5 ms 
tCw  := tInc * 1300                      ' Clockwise fast = 1.3 ms 
tCcw := tInc * 1700                      ' Counter-Clockwise fast = 1.7 ms 
t    := cnt                              ' Mark counter time 
 
repeat 100                               ' Repeat PWM signal 100x 
  phsa := -tCw                           ' Set up clockwise fast pulse 
  t += tC                                ' Calculate next cycle repeat 
  waitcnt(t)                             ' Wait for next cycle (20 ms) 
 
repeat 100                               ' Repeat PWM signal 100x 
  phsa := -tCtr                          ' Set up the center pulse 
  t += (tC + 200)                        ' Calculate next cycle repeat 

Summary of Contents for Continuous Rotation Servo

Page 1: ...mounting screws Easy to interface with any Parallax microcontroller or PWM capable device Very easy to control with the PULSOUT command in PBASIC or SX B Weighs only 1 50 oz 42 5 g 38 oz in torque 6...

Page 2: ...gram below for jumper settings Servo current draw can spike while under peak load be sure your application s regulator is prepared to supply adequate current for all servos used in combination Board o...

Page 3: ...o their holder Vbp Vss P12 White Red Black Vbp Vss P13 White Red Black P15 P14 P11 P10 P9 P8 P13 P12 X3 Vdd Vss Vin 916 624 8333 www parallaxinc com www stampsinclass com Rev B P15 P14 P11 P10 P9 P8 P...

Page 4: ...servo may take some patience The potentiometer is very sensitive so a very light touch will be required CenterParallaxCrServo bs2 STAMP BS2 PBASIC 2 5 SELECT Stamp CASE BS2 BS2E BS2PE PULSOUT Duratio...

Page 5: ...allax Continuous Rotation Servo is controlled through pulse width modulation Rotational speed and direction are determi ned by the d uration of a high pulse in the 1 3 1 7 ms range In order for smooth...

Page 6: ...ifferent units for the P ULSOUT command s Duration argument When adapting BS2 code to another BASIC Stamp model you may need to make adjustments The table below lists the PULSOUT ranges for each BASIC...

Page 7: ...from the 900 00008 product page ServoContinuousRotation spin Turn Parallax Continuous Rotation Servo clockwise full speed for 21 sec hold still 2 sec and then counterclockwise full speed for 2 sec CO...

Page 8: ...lockwise fast pulse t tC 200 Calculate next cycle repeat waitcnt t Wait for next cycle 20 ms Revision History Version 2 1 corrected values in BASIC Stamp Model PULSOUT table updated example programs t...

Page 9: ...Mouser Electronics Authorized Distributor Click to View Pricing Inventory Delivery Lifecycle Information Parallax 900 00008...

Reviews: