RS232 Interface?

Started by
6 comments, last by bit64 19 years, 4 months ago
Hi, i am looking for some code to communicate with devices on an rs232 serial port. I found a lot of examples but they where all dos based or had giant heaps of messy redundant code around it. I need some code examples or just the names of the functions i should use, a library would be fine too as long as it still offers me all basic possibilities. I am using msvs 2005 beta with a win32 or win32console app. Thanks a lot.
Advertisement
Could you be more descriptive of what you are trying to achieve? What kind of device do you want to communicate with exactly, and why? I will try to help you if I know that info.
Don't be afraid to be yourself. Nobody else ever will be.
Try this link:

Serial Programming Guide
For a project related to college (no homework) we are trying to remote-control some rc car we made using the rs232 serial port. Some teacher is making an rs232 input in the controler but he doesn´t know anything about programming it (only the hardware part of it) so i got to do it.

I don't know anything about the protocol the controller will be using (if that even matters, if it does, please say so) so i need to know how i can read and write bits or bytes to a specific serial port.
Quote:Original post by Tree Penguin
For a project related to college (no homework) we are trying to remote-control some rc car we made using the rs232 serial port. Some teacher is making an rs232 input in the controler but he doesn´t know anything about programming it (only the hardware part of it) so i got to do it.

I don't know anything about the protocol the controller will be using (if that even matters, if it does, please say so) so i need to know how i can read and write bits or bytes to a specific serial port.

What language are you using to program?

I made a project that did this a while agao (still should work)...if you're using C/C++, I can send you it.
I believe that would be easier to make using the parallel port, electronically speaking, as you could actually do it without a microcontroller to decode the signal. You can enable the current on individual pins, and hence, controls relay, or many individual electronic circuits.

Good luck!

Looking for a serious game project?
www.xgameproject.com
You could try the MSCOMM32.ocx ActiveX control. (Look it up in MSDN)

EDIT: Or even better, click here.
[ PGD - The Home of Pascal Game Development! ] [ Help GameDev.net fight cancer ]
I would agree with Max_Payne, in that parallel comms would be a better option in this case.

However, if your project calls for serial comms then the MSDN article posted by Useless_Hacker tells you all you need to know about communicating over serial. (However, the OCX control he mentions should not be used, as it has been deprecated.) If you only need to write to the port, then your life should be fairly easy, but you may need to read (depending on the microcontroller you are using, it may send you a packet to confirm that it received your last comms. If it is a programmable microcontroller then you should be able to dictate the protocol yourself.)


Good luck.
Don't be afraid to be yourself. Nobody else ever will be.

This topic is closed to new replies.

Advertisement