Hello guys this is my first post
I was having trouble interfacing a remote controlled car using serial port
I have made the circuit for interfacing the serial port with the relays to control the car remote but the problem is that I need to make a C++ or C language program to interface the serial port so that I can send signals to my micro-controller which will further control the relays which control the remote of rc car.

Sounds like an interesting project. Have you written code that communicates over a serial-port before? It's been so long since I've done so (more than 10 years ago) that I wouldn't be much help. I suspect a Google search would get you well underway.

Sounds like an interesting project. Have you written code that communicates over a serial-port before? It's been so long since I've done so (more than 10 years ago) that I wouldn't be much help. I suspect a Google search would get you well underway.

Well I am new to serial port programming so this will be my first project in serial port however I can provide a little bit of detail of what I have gone through so far, if you are willing to help and that detail will give you an idea about my project

Here is the link for the circuit I am using http://www.8051projects.info/proj.asp?ID=54 except the fact that I am using at89c51 micro-controller.
I will post the source code soon or you may get it from mail as well.
Although I have the basic source code for the micro-controller to operate on receiving signals i.e. '8' for forward, '6' for left , etc but I need to make a program in C or C++ that will help me send the data of button '8' when pressed to the micro-controller through a serial port

I did my serial-port programming in a Unix environment, so the low-level structures are probably different in Windows, but the bottom line was I could open the serial port like a file and use the low-level file operations to read/write, like:

int fd = open("/dev/ttyS1", O_RDWR);
/* do some serial-port-specific control/initialization stuff */
...
if (write(*dataptr, word_size, num_words, fd) != num_words) {
    /* error writing to port */
}

Looks like the .NET Framework for Windows provides a SerialPort class which will presumably help to encapsulate some of the mess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.