Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

serial port output 1

Status
Not open for further replies.

rmageddon

Programmer
Jun 4, 2001
3
0
0
GB
Hi there!
Could someone please point me in the right direction for programming a serial port to activate a motor.
Is there a particular API for serial communication in VC++ 6? I have briefly looked through the MSDN stuff but couldn't find anything particularly informative. Any help will be much appreciated. I am not too worried about the hardware side of this problem, I just need to know how to get started from the software side.
Thanks in advance.
 
Here is some API calls to open the serial port and use it :

CreateFile Open the port,
WriteFile write to the port (like to file)
ReadFile read from the port
CloseHandle Close the port ;)
SetupComm Initialize the communication

there is a struture called "dcd" it's used to pass every parameter, like baud rate, flow control,....

GetCommProperties to read it
SetCommState to set them

GetCommTimeouts read the timeouts
SetCommTimeouts set the timeouts

PurgeComm purge the input or/and output buffer
ClearCommError clear the port error

there are some other API calls...
If you wish I can show you some example.

I hope it helped a bit,
small%20P.gif

Cedium
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top