Link to home
Start Free TrialLog in
Avatar of schmim04
schmim04

asked on

Bare minimum upload

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
Avatar of schmim04
schmim04

ASKER

Edited text of question
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.
I use WaitCommEvent(). it gives much more control. The timeouts in the dcb have questionable effect IMHO.  Good luck
eric
ASKER CERTIFIED SOLUTION
Avatar of piano_boxer
piano_boxer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial