Solved

Bare minimum upload

Posted on 1998-04-08
4
302 Views
Last Modified: 2013-12-03
I just want to configure the COM port to recieve data.  Once the COM port is configured to recieve data, it must be able to sit and wait for the data to start coming, for up to a minute or so if possible.  I use the following functions
in order:

1.  I set aside memory for the struct DCB
2.  BuildCommDCB(); *settings = "COM2: baud=9600 parity=N stop=1";
3.  CreateFile();
4.  ReadIntervalTimeout = 2000;
5.  SetCommState();
6.  ReadFile();

The data is read into:  char *buffer = new char[2000];
It works pretty well at recieving, I just want to make sure I haven't left out crucial functions.  Do I need to add more commands like the DTR and RTS commands or am I on the right track?  I'm using C++ builder and once I push a button on my display all the above commands are executed and the COM port waits for data.

Thank You:  Mike
0
Comment
Question by:schmim04
4 Comments
 
LVL 1

Author Comment

by:schmim04
ID: 1412633
Edited text of question
0
 
LVL 2

Expert Comment

by:sprinkmeier
ID: 1412634
Looks OK...
What more do you want? handshaing? buffer-overrun handling? async operation?
From the help pages, go to "view group" and scan the list of API functions in that group. look up any that sound interesting.
0
 

Expert Comment

by:eek105
ID: 1412635
I use WaitCommEvent(). it gives much more control. The timeouts in the dcb have questionable effect IMHO.  Good luck
eric
0
 
LVL 4

Accepted Solution

by:
piano_boxer earned 20 total points
ID: 1412636
Be sure to call ClearCommError() before ReadFile() otherwize your reading may fail bacause of a communication error thats not cleared.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now