Shop OBEX P1 Docs P2 Docs Learn Events
Requesting Sample Coding for the PSC — Parallax Forums

Requesting Sample Coding for the PSC

gr8_big_geekgr8_big_geek Posts: 34
edited 2009-05-28 20:02 in BASIC Stamp
Greetings,

I recently purchased the Parallax Servo Controller (PSC) and have gone through the downloadable PDF file about it and used the sample code it has there. The only problem is that it never shows how to programically use multiple servos at one time (which was the reason for the purchase in the first place). It only shows how to operate one servo at one time.

One thing I·believe that is totally awesome is that your motor does hold in·its place REALLY well. You say go to 9 O' clock and it goes there AND STAYS! The total bumber is when you try·and have motor two go to say, 3 O' clock and stay, nothing happens, the motor never·engages.

Either·way, any help you could provide would be most useful. I have attached my sample program to this as well.

Thank you in advance!

Your geek~
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
ch VAR Byte
pw VAR Word
ra VAR Byte
Sdat CON 0
baud CON 396
'----------------------(Elbow Motor Control)----------------------------------
ra = 7
ch = 0
pw = 900
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
PAUSE 1000
pw = 250
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
PAUSE 1000
'I need this motor to stay right here and then the next command to begin...
'-----------------------(Wrist Motor Control)---------------------------------
ra = 7
ch = 2
pw = 1000
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
PAUSE 1000
pw = 200
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
PAUSE 1000
'only nothing is happening. I have checked and rechecked all of my connections. 
'each motor works independantly, just not together on the same program. 

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-05-28 17:55
    Hi, can't be much too wrong. A couple of suggestions after reading the PDF , make sure to remove the jumper from the board , the value for pw should be between 250 and 1250 ( you have a value of 200 in one instance ) , you skipped from chan 0 to chan 2 in code make sure you didn't inadvertantly plug a servo into chan 1 , use an adequate seperate power supply for servo power ( make the grounds common ) and you might also consider·just one·sub routine for every servo to cut down on code.



    elbow CON 0
    wrist CON 2
    counter VAR Word
    ch VAR Byte
    pw VAR Word
    ra VAR Byte
    Sdat CON 0
    baud CON 396
    ra = 7
    ch = elbow
    pw = 900
    GOSUB servo
    PAUSE 1000
    pw=250
    GOSUB servo
    PAUSE 1000
    ch = wrist
    pw = 1000
    GOSUB servo
    PAUSE 1000
    pw=250
    GOSUB servo
    PAUSE 1000
    
    '----------------------(Servo Motor Control)----------------------------------
    Servo:
    SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    return
    

    Jeff T.
  • gr8_big_geekgr8_big_geek Posts: 34
    edited 2009-05-28 20:02
    Thank you very much for looking over all of that for me! I did figure out what happened. Apparently when I plugged in all of my wires I burned out/fried (completely) ch 1 & 2. I had my power in wrong or something. I tried in other ch's and it worked. Also, in the process of burning out those ch's, I blew one of my servos. Not sure what the lesson is to be learned here; maybe spend more money?

    Either way, I'm grateful for your time and you have been a wonderful help in my process toward robotic automation! [noparse]:)[/noparse]

    gr8_big_geek
Sign In or Register to comment.