Shop OBEX P1 Docs P2 Docs Learn Events
Software for Parallax Servo Controller (PSC) USB — Parallax Forums

Software for Parallax Servo Controller (PSC) USB

OualidOualid Posts: 12
edited 2005-10-23 07:40 in BASIC Stamp
I would like to send some commands to Parallax Servo Controller (PSC) USB.

For example to identify Firmware Version Number:

'{$PBASIC 2.5}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP



My question is: Which software should I use to send the code above to PSC?

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-19 07:50
    Oualid -

    I'm not sure you're really asking the question you want to. The reason I say that is the question you asked pretty much has a self-defining answer, based on the sample code you provided.

    You have shown an example of a Parallax PBASIC Program, so the answer to your question as to what software to use, is Parallax PBASIC. If on the other hand you're wondering which VERSION of PBASIC to use, always use the latest version available. At present, that's Version 2.2 which can be downloaded from here:
    http://www.parallax.com/html_pages/downloads/software/software_basic_stamp.asp

    If your confusion is in justifying the "'{$PBASIC 2.5}" compiler directive, and the present Version number of the Editor/Compiler (2.2 as noted above) the two DO NOT necessarily coincide. The latest PBASIC Compiler Version is 2.2 and the example program was written to be run on ANY PBASIC Compiler which supports the PBASIC 2.5 syntax level. I hope that clears that up.

    Just as an aside, you will need the baudmode parameters to be the same in both your SERIN and SEROUT commands before the example program will operate properly.

    Regards,

    Bruce Bates
  • OualidOualid Posts: 12
    edited 2005-10-19 08:23
    Thanks for the answer.

    My question was "what software to use" and you gave me the answer.

    Do you mean "BASIC Stamp Windows Editor version 2.2" ?

    In fact I downloaded "BASIC Stamp Windows Editor version 2.2" but I couldn't connect to the PSC.

    I know that the PSC works fine because I tested it with my own application that I wrote in Delphi.

    For instance the code that I wrote down is taken from the PDF document "Parallax Servo Controller (#28023) – Rev B" on page 4.
    Is it incomplete?

    Regards.

    /Oualid
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-19 08:47
    Oualid -

    As I noted earlier, the sample program which you listed will NOT work the way it is, although it WILL compile correctly.


    Regards,

    Bruce Bates
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-19 14:44
    It sounds like you're trying to download to the PSC without a BASIC Stamp.· This cannot be done.· If you're trying to use the PSC without a BASIC Stamp, and through the USB connection, you will need to send the ASCII command codes, as well as their binary parameters through a serial connection established with the PSC.· The code you posted is for the BASIC Stamp to talk to the PSC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • OualidOualid Posts: 12
    edited 2005-10-19 20:23
    Of course!
    That's why I can't connect to the PSC!

    Do you know if the following command works correctly on the PSC?

    RSP Command – Report the Position of a Servo Channel
    Syntax: “!SCRSP” x $0D
    Reply: x y z(where x is the channel number, and z:y is the value reported)

    I send:

    "!SCRSP","1","char(13)" by using an application that I wrote in Delphi to get the position of the servo connected to channel 1.

    What I receive from PSC is x=1 but the values of y and z are missing.

    The firmware version of PSC is 1.4

    Any idea?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-19 21:37
    Hello,

    ··· The documentation at the following web page really has everything you need.· You will need to send the ASCII string !SC which is 3 characters, followed by the binary value (one byte) of the channel number, followed by the binary value (one byte) of the ramping value, followed by two bytes for the lowbyte and highbyte of the pulsewidth, followed by a carriage return character.· This comes out to 8 characters being sent.· Other commands follow a similar structure.· As long as you have the USB Driver installed, then the PSC is assigned a COM Port, and can be communicated with just as any serial device, from any application that can open a COM channel at the appropriate speed and parameters.

    http://www.parallax.com/detail.asp?product_id=28023

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • OualidOualid Posts: 12
    edited 2005-10-21 07:35
    Yes the documentation is good. But what about the following command?

    RSP Command – Report the Position of a Servo Channel
    Syntax: “!SCRSP” x $0D
    Reply: x y z(where x is the channel number, and z:y is the value reported)

    What I receive from PSC is x (channel number) but I don't receive any z:y value.

    My question is: Does PSC software work correctly?

    Post Edited (Oualid) : 10/21/2005 7:38:27 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-21 15:12
    If you send, "!SCRSP", <channel>,·$0D it should return the correct values.


    (The above code was modified to add the channel specification that I missed, sorry)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 10/21/2005 4:07:55 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-21 15:17
    I don't know that this will help you at all, but the PSC does indeed return position value for the specified channel.· I wrote this BS1 code for an EFX customer: http://forums.parallax.com/attachment.php?attachmentid=39171

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • OualidOualid Posts: 12
    edited 2005-10-23 07:40
    Many thanks for the help everyone!
    Now it works.
Sign In or Register to comment.