Shop OBEX P1 Docs P2 Docs Learn Events
Sending commands to the Serial Servo Controller with the Propeller. — Parallax Forums

Sending commands to the Serial Servo Controller with the Propeller.

MarkUSFMarkUSF Posts: 4
edited 2009-02-26 20:58 in Propeller 1
I've been trying to figure out the format for sending serial commands to the Parallax SSC but can't seem to get it right. Mainly I need to figure out how to translate the BS2:

SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

to propeller format. I looked in the SSC manual and I couldn't figure out the sizes of ch, ra, and pw.lowbyte/pw.highbyte. i know there are objects which would allow servo control from the propeller alone but we have VERY limited time and that would create too many alterations from our design. We started with the BS2 and realized we needed the power of the Propeller late in the game.

Anyway this is what we tried and couldn't get to work:

obj

Servo : "FullDuplexSerialPlus"
Servo.init(2,3,2,2400)

Servo.str(string("!SC"))
Servo.bin(ch)
Servo.bin(ra)
Servo.bin(pw,16)
Servo.tx(13)

Also, does the SSC reset to 2400 baud everytime you press the hard reset button?

Comments

  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2009-02-26 02:22
    If I remember correctly SSC speed at reset depends on the jumper settings.
    What command are you trying to send? How did you define 'ch', 'ra' and 'pw'?
    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • MarkUSFMarkUSF Posts: 4
    edited 2009-02-26 02:40
    Ra&Ch=byte pw=word. I did specify 8,8,&16 for the bin param too.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-02-26 02:48
    Hi Mark, did you try anything similar to the following , splittng the word to bytes.

    · pw_lowbyte := pw & $FF
    · pw_highbyte := pw >> 4 & $FF

    · Servo.str(string("!SC"))
    · Servo.tx(ch)
    · Servo.tx(ra)
    · Servo.tx(pw_lowbyte)
    · Servo.tx(pw_highbyte)
    · Servo.tx(13)

    Jeff T.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2009-02-26 02:57
    You can only send bytes to the SSC.
    What is the sequence you are trying to send?
    Jim-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • MarkUSFMarkUSF Posts: 4
    edited 2009-02-26 04:18
    Well the ssc takes "!sc" as the first part then ch and ra as bytes and pw as low and high byte. Is that what you meant by sequence?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-26 04:41
    Unsoundcode was mostly right. Do:
    servo.str(string("!SC"))
    servo.tx(ch)
    servo.tx(ra)
    servo.tx(pw & $FF)
    servo.tx(pw >> 8)
    servo.tx(13)
    


    The servo.bin won't work for you since it translates values into strings of "0" and "1" where these are the characters, not individual bits from the value. servo.bin(23,5) will give you the transmitted string of "10111".

    Post Edited (Mike Green) : 2/26/2009 4:47:13 AM GMT
  • MarkUSFMarkUSF Posts: 4
    edited 2009-02-26 20:58
    That worked very well. Thanks alot!
Sign In or Register to comment.