Solved

Bare minimum upload

Posted on 1998-04-08
4
301 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

11 Experts available now in Live!

Get 1:1 Help Now