469,327 Members | 1,238 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

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 9698
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.