Does anybody use C++ under Linux to talk with the SSC?

hi at all…

is somebody working with C++ to talk with the SSC Controller???
If yes …

please help me to get started with this stuff :wink:

To specify my problem,
I want to use c++ to write a program, which can control my SSC… But…
I am not that good in C++ programming… (not yet)

so can anybody write me a small cpp code to get started and to play around with??

It should do the following:

1 open serial Port with the specific settings for SSC

2 send one servo position command (as refernce for me, to see how it works generally)

3 close Port

Thanks a lot … !!!

Will you be using Linux?

Have you tried Google for “C++ serial” ?

There are many examples available on the internet.

Have you read the SSC-32 manual?

8-Dale

Yes I will use Linux

Yes, I tried google search, and yes I found some stuff, but somehow, its not working… I will try a bit more later this day …

and yes, I read the SSC manual…

But, for me it´s way easier to ask somebody, who maybe has already more experience with that than me,
and maybe there is a guy out there who is already doing that what I want to do… (linux, c++)
that´s why I was asking for that,
If there is no one, OK, I will try out myself…

I could help you w/ C/C++ in most flavors of windoze, but for linux support there are probably only very few of the regulars here writing their own code. :frowning:

Post the code you are having problems with. Be sure to post enough of your code so we can see the context and what calls it if any. Sometimes the problem is not with the actual code, but the call to the code.

Show where you are having the problem.

Tell us what kind of problem it is.

It will be much easier to help you if we know exactly what you are working with.

8-Dale

Hi Linuxguy

what I have is a small bunch of code frazzles, which I found on various places in the net…

What I want to achieve with that, is just to see that I can send something out of the COM port…

so here is that what I have so far

my problem now iis, that the program returns “write() of 4 bytes failed”
So n = -1, and that means that an error occurred :frowning:

the command “n = write(fd, “ATZ\r”, 4);” is just an example from the net, I´m not sure if this is the right method to send position strings to SSC like “#0 P1500”

Um, you don’t actually assign the fd passed back by OpenPort() to fd in main(), so fd in main() is still un-initialized.

Seems like the compiler should have flagged that as a warning. :open_mouth:

ok…

but when I put it into main it isn´t working as well :frowning:

or does I misunderstood you???

no, you got the idea but all you really needed to do was change the OpenPort() line to fd = OpenPort(). :slight_smile:

dumb question: are you certain ttyS0 is defined for your install and that you have permissions set to allow its use? we could spend a lot of time chasing code things if not. :slight_smile:

at what point do you get an error message, or is it running but just not making the SSC-32 do something?

the code looks like it should work, from what I remember, so if it were me I would be putting text output statements after each line and displaying the contents of the results to find where something was not what I expected and then find out why.

I´m executing this program as root, so I should have all permissions…
With this program the SSC will do nothing :wink: because the statement what I send is not an SSC command, it´s just a bunch of chars :wink:

but what I just want to see is that this prog will send chars on the port without errors…

hm maybe I should try to send a SSC Command look if gren led turns off

hm no … I tried to send

write(fd, “#0 P1500\r”, 9);

The steady green LED stays green, so the SSC dows not receive anything :frowning:

But, at first, Yes the SCC is working correctly, :wink: I tested it with Lynxterm on my Windows PC

Any chance the handshaking is enabled on the port when you open it? I don’t know what the default options are in termios struct, perhaps something need to be set or cleared to disable handshaking?

maybe, I don´t know

that´s why I asked at the beginning if somebody is already working with c++

try adding

if ( 0 > tcflow( fd, TCOON) )
fputs( “tcflow() failed\n”, stderr ) ;

after the tcsetattr() call.

:lol: they are all hiding it appears. :unamused:

perhaps this will help?
lafn.org/~dave/linux/Serial- … -HOWTO.txt

That is not a dumb question at all.

The permissions need to be checked as well as that the user is in the appropriate group(s) for access. He needs to check the /dev directory and see what group the tty* ports are in. This is usually the tty group, but may differ depending on the distribution of Linux. He needs to be in that group to be able to access the tty* ports.

8-Dale

AHHHHHHHHHH HIT ME!!!

It is wörking now :unamused: I can send this “center” Command to the first Servo …

The problem was…[size=59]the COM Port was disabled at BIOS level [/size]

I don’t dare to say it loud :blush:

But thanks for your help, now I can play araund with that what I have, and later on I will annoy you with other Problems … :slight_smile:

lol. good luck. :wink:

I´m able now to send ONE position command to the SCC, if I want to send a sequence of commands I have to wait until the SSC completes the last command until I can send the next one, right?

I read something that I have to send a “q” to the SSC and I will get a dot or a plus. Can I ask the SSC for a certain Servo, or is the answer global for the SSC?

Will it check if a certain Servo has completed its move or is it checking if the hole last command is finished???