Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Bare minimum upload

Posted on 1998-04-08
4
Medium Priority
?
313 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 40 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

604 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