Communication: C++ program to SSC-32 controller?

Hello, I am working with the Lynx 5 Arm and I am trying to find example code for how to send messages to the SSC-32 controller. To be more exact, I am trying to have a C++ Win32 console application (and ultimately an eMbedded C++) on my computer send messages to the controller that the controller can then interpret and use to activate the various servos.

I understand from the SSC-32 manual that the controller accepts commands of the form “# P S ” or “# P T ”, or some grouping thereof, but I am unsure of whether and how it would be possible to send such messages from a C++ program to the controller. I have looked for source code for the SSC-32 Terminal, since that seems to be the kind of application I would want to create, but I have been unable to find any such thing.

I do have a program that opens a serial port, sets buadrate, parity, databit and so on and can send messages from one computer to another via 9-pin serial cable, but when I try to use it with the SSC-32 controller, there is no indication that it works. That is, the servos do nothing and so I cannot tell if there is firmware on the controller that has received the messages and parses them as garbage, or what. If anyone could advise me on these issues, it would be much appreciated. I can also offer any necessary clarification.

Thank you.

I have Java code you are free to use if you want. Basically, it is a duplicate of the LynxTerm program. The syntax will be a bit different for C++, but I am not sure what specifically you would need to change.

You can tell if the SSC-32 is receiving data when the light blinks. If it blinks when you send it something, that is a very good sign. What may be happening is that you are not sending the CRLF character at the end of each command. That is, you must send it the carriage return and line feed characters. For Java, these are not the same character, as Andy pointed out to me. For C++, I believe I remember reading that it is ascii character 13, but I may be wrong on that.

Hope this helps.

Mike

If you’re certain that serial port settings are correct and you’ve verified the code works with another computer and a null modem, get the setup working with LynxTerm. Two common problems people have when trying to get it to respond are the termination characters CR and LF (ascii 10 and 13) “\r\n”.

Another thing you should be certain of is that you’re using ANSI strings not Unicode strings.

I believe there is an LED on the controller that flashed when it receives data. Verify that this is flashing when you are sending data to it.

To clarify, are you suggesting I make sure the LynxTerm can talk to the arm? For example by running it and trying “#5 P150 \r\n”?

I know that eMbedded C++ (what I’ll ultimately use) defaults to Unicode, and I believe for that there are ways to convert to ANSI, but with plain vanilla C++ I will have to check as you say. And using the LED on the controller as a debugging tool should prove useful. Thanks.

Yes, I was suggesting using LynxTerm to verify the hardward setup. If you can succesfully communicate via LynxTerm, than you can rule out a whole host of issues like driver setup, the cable your using, power to the SSC32, and many others.

The proper syntax for that is:

#5 P1500 <cr>

“P150” is probably too low a pulse, most servos operate from 750 to 2250.

“\r\n” is strictly a C++ thing, I believe.
is what you use in the LynxTerm for a carriage return (and a line feed).
It’s equivalent to “VBcrLf” in Visual Basic, so I suppose that those are both equivalent to the C++ “\r\n”.

I got a C++ program to send the LynxArm commands in the form

#5 P1500 S750\r\n

I even got an eMbedded C++ program to move the arm with the same format of command. I’m having some difficulty when I try to send the command from the C++ program to the eMbedded C++ program and then to the arm. The problem may have to do with whether somewhere in the message passing the message is converted to something other than ANSI, I’m not yet sure. But the LED on the controller does blink to indicate that it received SOMETHING, so that’s encouraging.

I just now tried using the syntax, and that doesn’t seem to be the issue. I appreciate all of the help thus far though… from everyone.

I’m not sure if I follow. Are you saying you managed to get the … um…
“fullsize” C++ code to successfully communicate with the controller? If you haven’t done so successfully, I’d suggest you try this before attempting to deal with an intermediary.

I have a program I wrote in Visual C++ that communicates with the controller. I also have a program in eMbedded C++ that allows a palmtop to communicate with the crontroller. The former was just a first step to figure out how to do the latter. I am now working out how to have the PC (laptop/desktop) send messages to the palmtop, which in turn will send messages to the controller. I think I am nearly there, I was just getting hung up initially.

I do realize this all sounds convoluted, but it is a way of increasing processing power for the robot that is directly run by the controller that I’m working on.

I appologise, I’m afraid I wasn’t being very clear.

To clarify what I meant:
is the proper ending when using the LynxTerm.
VbCrLf is the proper ending when using Visual Basic
\r\n is the proper ending when using C++