April 15th, 2004, 07:56 AM
Controlling DTR line of serial port
I have connected a led to the DTR line of the serial port just for testing purposes.
Turning the led on/off works just fine with the EscapeCommFunction() function which sets or clears the DTR line.
However, there is a problem. As soon as the serial port is opened with CreateFile(), there is a short pulse on the DTR line which causes the led to blink very shortly. Does someone knows how to prevent this startup pulse to occur?
Thanks in advance.
m_hPort = CreateFile(
portName, // Pointer to the name of the port
GENERIC_READ | GENERIC_WRITE, // Access (read/write) mode
0, // 0, serial ports can not be shared
NULL, // Pointer to the security attribute
OPEN_EXISTING, // How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute to copy
// If it fails to open the port, return false.
if (m_hPort == INVALID_HANDLE_VALUE)
Time is fun when you're having flies
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!