Discussion Locked

serial communications

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how would i access the serial port using visual c++?

5 replies

by vinnyd

Open the Port using "CreateFile"

Send a character using "TransmitCommChar"

Call "ClearCommError" to get status of the port

Call "ReadFile" to get the data characters from the serial device.

These are the functions that I use from the Microsoft SDK in C++ to interface with the serial port.

by rolie

You can access serial port register using the address 0x3f8 for COM1 and 0x2E8 for COM2, 0x3e8 and 0x2e8 for COM3 and COM4 respectively. You can read the values of this regiter by using INPORT() function. When writting to this register use OUTPORT()function.

This discussion is closed to new replies.