Solved

Bare minimum upload

Posted on 1998-04-08
4
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

696 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