Shop OBEX P1 Docs P2 Docs Learn Events
Working with propeller servo controller — Parallax Forums

Working with propeller servo controller

firestorm.v1firestorm.v1 Posts: 94
edited 2010-06-10 23:59 in Propeller 1
Mods: I'm not sure if this belongs in Basic Stamp (since the host is a BOE-BOT) or in Propeller (since the PSC uses a prop) so please feel free to move accordingly.


Hello everyone!

I'm working with the Propeller Servo Controller rev A with unmodified firmware to try and offload the servo pulse work to the PSC while the BS2 does other things and am hitting a snag. I can't make the servos "stop" at the end of the program or during the program's execution.

The goal is that the BOEBOT starts off facing one direction, moves forward 1 second, pauses 1 sec, turns right 90 degrees (ish) and then repeats to end up back where it started (basically forming a box). After either a "go forward" or a "turn right" maneuver, the BOEBOT is supposed to wait one second.

Here is the code for the BS2:

 FOR looper = 1 TO 4
  'Go forward
  pw1 = 1100
  pw2 = 300
  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Lservo, 7, pw1.LOWBYTE, pw1.HIGHBYTE, CR]
  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Rservo, 7, pw2.LOWBYTE, pw2.HIGHBYTE, CR]
  PAUSE 1000
  GOSUB ResetServos
  'Sleep for a second
  PAUSE 1000
  'Turn Right
  pw1 = 300
  pw2 = 1100
  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Lservo, 7, pw1.LOWBYTE, pw1.HIGHBYTE, CR]
  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Rservo, 7, pw2.LOWBYTE, pw2.HIGHBYTE, CR]
  PAUSE 250
  GOSUB ResetServos
  PAUSE 1000
NEXT
DEBUG "ALL CLEAR TONE",CR
FREQOUT 0,2000,3000

END


' -----[noparse][[/noparse] Subroutines ]-----------------------------------------------------

ResetServos:
  'SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SCPSD", Lservo, CR]
  'SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SCPSD", Rservo, CR]
  'PAUSE 10
  'SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SCPSE", Lservo, CR]
  'SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SCPSE", Rservo, CR]

  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Lservo, 7,  pwstop.LOWBYTE, pwstop.HIGHBYTE , CR]
  SEROUT psc, Baud+$8000,[noparse][[/noparse]"!SC", Rservo, 7, pwstop.LOWBYTE, pwstop.HIGHBYTE , CR]
  PAUSE 10
RETURN




As shown above, I tried toggling the servo's enable states as well as giving them a position of 0 but neither option worked. (it is safe to assume that "pwstop" is type "WORD" and is initialized to value zero at start of program).

I appreciate any help with this as I'm trying to figure out how I can use the PSC in working with the Basic Stamp. My theory is that I can tell the PSC to travel in a given direction and leave the BS2 to monitor sensors, log data, etc... and tell the PSC to change course as needed without the BS2 having to drive the servos directly.

Thank you!

FIRESTORM_v1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-07 00:46
    What's "pwstop"?
  • firestorm.v1firestorm.v1 Posts: 94
    edited 2010-06-07 01:20
    pwstop is set to 0. I've also experimented with setting it to 800 but to no avail (median between 300 and 1100)
  • FireHopperFireHopper Posts: 180
    edited 2010-06-07 02:24
    to stop continous rotation servos.. send a 1.5 us pulsetrain. for the propeller servo controller.. send a pw of 750

    adjust for your particular servos..
  • firestorm.v1firestorm.v1 Posts: 94
    edited 2010-06-10 23:59
    FireHopper:

    That did the trick! I feel dumb. :P

    Thank you for helping me out, now my BOE-BOT won't be falling off the table anytime soon.

    FIRESTORM_v1
Sign In or Register to comment.