C++ serial help

newcastlenellie

Junior Member
Jan 14, 2006
20
0
0
Hello, I'mdoing a master in mechanical and mechatronic engineering, for my project I am creating/designing the motion control system for a mobile autonomous robot.

I have inherited an old robot with a vey old motion control card, I have worked out how to programme the card from the examples. However for the AI of the robot we are using player and orca, which are linux based programmes which will be running on a seperate 'server' computer.

Any programme for the motion control card has to be written ( I think correct if I am wrong) in windows as the only c++ library for the card has been written for ms visual c++, and wont work on anyother c++ ide (i wasteda month fighting it trust me!) so the programmes have to be compiled in visual c++.

My current aim for the project is to send instructions from the server computer to the robot via a wireless link (such as zigbee) does anybody know of any examples of code, or how to take a byte of data from a com port and use it as an input in a programme? my plan was to send say a 1, which would make the robot move forward, and 2 would make it turn!

any help greatly appreciated, i have found code to tx and rx data over the com port, just not sure how to use it as a simple input. my current programme you click on a button and the robot moves which ever way. so aiming to change the input from a mouse click on a button to an input from the com port! sorry about the epic proportions of this post, have been a member of the forums for ages just never post!

cheers
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Usually, you sent a stream of ASCII charcters which form a command to the serial port.
You can also read characters from the serial port that are acting as feedback from your device.

What you need to get is the command set that the robot requires for manuvering.
Then you can send the proper commands out the communication port.
The Communication port can be opened with the proper baud rate and control parameters as defined by the hardware.

There are examples of setting this up within the MSDN and there may be a small I/O program for reference.
 

programmer

Senior member
Mar 12, 2003
412
0
0
So the library for the card is a dll, right? When you run dumpbin /exports <filename.dll> on it, do you get decorated or undecorated names? It may be true that you have to use visual C++ (or probably just any compiler that creates PE-format binaries), but I think it unlikely the lib is C++. The functions are probably exported as C functions. Even if 'slightly' decorated (with the param sizes) you can do some tricks to get the undecorated names.

Can you post the results of the dumpbin command (or at least the first few function names)?