473,378 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 9865
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sarah | last post by:
hI, I have a project. I need to realise serial communication between PC and Altera FPGA in c or c++. The function of FPGA is working well. it can send data to uart. Does anybody know how to...
3
by: carmen | last post by:
I'm working in an aplication for a Smart Device that need to "talk" with a printer continuosly through the serial port. I'm trying to use the John Hint's sample code "Use P/Invoke to develop a .NET...
4
by: Vidya Bhagwath | last post by:
Hello Experts, I am porting the C++ code into the Visual C#.NET. My C++ code is mainly based on the serial communication. So I am using the windows structure such as DCB.. etc and the windows...
7
by: Michael Chong | last post by:
I wrote a program that communicate with SerialComm. In every 300 milliseconds, my program continuously send & receive data via the serial port once the program starts. My program is once in a...
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
2
by: Marco Trapanese | last post by:
Hi, every 250 ms (timer event) I must send several commands via serial port. The serial unit will answer to each command sent. I must wait the answer before send the next command. How can I...
4
by: max_mont | last post by:
Hi all, I'm a newbie in .NET technology. I've already developed Serial communication applications in C++ (WIN32). And I wanted to migrate to .NET technology. There is a serial component in...
2
by: Adrian Chen | last post by:
please help me! I come across a problem. Now I develop a finger print management system which is based on B/S.When users click a button in the web pages, a device connected to the COM1 serial port...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.