472,117 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

Serial Communication Code example

I have a target box connected to my desktop (x86 Windows 2000) PC
through a serial cable (COM port). The target box running on different
processor and OS. The target box needs to send a specific formatted
data (2 bytes header + 128 bytes data) asynchronously through the
serial port and I've to capture it at the host PC side and save those
into a file.

I like to have the client-server model. The PC will be a server and
start a forever loop process to wait for client's (target box) data
and read its COM port and collect those data and save in a file. Note
that, client target box runs a process which sends those data after
some asynchronous event occurs.

Please refer me to any code example either in C or C++ for
implemneting the establishment of serial communication, read the data
from COM port etc. at the host PC side.
Nov 14 '05 #1
1 9784
On 14 Jan 2004 20:26:23 -0800, ja************@yahoo.com (Jamil) wrote
in comp.lang.c:
I have a target box connected to my desktop (x86 Windows 2000) PC
through a serial cable (COM port). The target box running on different
processor and OS. The target box needs to send a specific formatted
data (2 bytes header + 128 bytes data) asynchronously through the
serial port and I've to capture it at the host PC side and save those
into a file.

I like to have the client-server model. The PC will be a server and
start a forever loop process to wait for client's (target box) data
and read its COM port and collect those data and save in a file. Note
that, client target box runs a process which sends those data after
some asynchronous event occurs.

Please refer me to any code example either in C or C++ for
implemneting the establishment of serial communication, read the data
from COM port etc. at the host PC side.


The standard C language, the topic of this group, has no support for
any hardware devices at all. All input and output is defined strictly
in terms of <stdio.h> FILE * streams.

You need to ask this question in a group that supports your particular
compiler/OS combination, to find out what non-standard extensions
might be available for this sort of thing. Just specifying that it is
a PC is not nearly enough. The extensions will be completely
different on the same PC depending on whether it is running MS-DOS,
Windows, Solaris, Linux, BSD, OS/2, or some other operating system.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by carmen | last post: by
7 posts views Thread by Michael Chong | last post: by
6 posts views Thread by Leandro Berti via DotNetMonster.com | last post: by
2 posts views Thread by Marco Trapanese | last post: by
4 posts views Thread by max_mont | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.