PDA

View Full Version : USB servo controller and Labview



bradleyk
01-24-2010, 09:12 PM
I've been trying to communicate with my Parallax USB servo controller using Labview 8.0.
When I send a "SCVER?" command using VISA write·and then try to read from the buffer all I get·is an echo of the·command. I've tried·sending the VISA read·twice·but then I get the command echo on the first read and a timeout error on the second.
The PSCI software works fine.
Any help would be much appreciated

Beau Schwabe
01-26-2010, 03:10 PM
bradleyk,

You are sending a "!SCVER?" plus a return character (13) correct? and not just "SCVER?"?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

bradleyk
01-26-2010, 10:32 PM
Indeed I am. However I am sending the carrige return as a /n or a $0D

thanks

Beau Schwabe
01-26-2010, 11:06 PM
bradleyk,

The Propeller USB Servo Controller code was written to keep compatibility with the previous Parallax Servo Controller and the PSCI software.

The PSCI sends a "U" character just prior to sending a version request as part of an auto baud negotiation scheme. If received, the "U" is echoed back in addition to the version request plus the version number. The detection code in the Propeller USB Servo Controller to handle this looks like this...




''MainLoop -------------------------------------------------------------------------
U_Flag := 0
repeat
Rx := GetDataByte
if Rx == "U" '' Look for a special case condition from the PSCI
U_Flag := 1 '' The PSCI uses this to auto negotiate baud
SendDataByte("U")
Rx := GetDataByte
if Rx == "!" '' Check for the "!SC" header for the PSC
Rx := GetDataByte
if Rx == "S"
Rx := GetDataByte
if Rx == "C"
Rx := GetDataByte
Logic '' Jump out here, because Spin only allows 8
'' nested IF statements



...



PUB Logic
case Rx '' Continue with PSC command Parsing



...



"V" : if GetDataByte == "E"
if GetDataByte == "R"
if GetDataByte == "?"
if GetDataByte == 13
VersionRequest '' Version request detected




... Upon detection, if the Propeller USB Servo Controller senses a "U" and the version request, it responds with U!SCVER?{13}1.0 (essentially an echo of the version request including the return prior to sending the version number) or it will simply respond with 1.0 if a "U" was not detected prior to the version request. The response code in the Propeller USB Servo Controller looks like this ...




PUB VersionRequest
if U_Flag == 0 '' Normal version reply
SendDataString(string("1.0"))
else
U_Flag := 0 '' Make the PSC compatible with the PSCI
SendDataString(string("!SCVER?",13,"1.0"))





... Just curious, since you are getting an echo of the command, either the echo is set from within Labview in which case all commands should be echoing, or somehow the Propeller USB Servo Controller thinks you are sending a "U" prior to the version request.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 1/26/2010 3:23:20 PM GMT