Hey!
I have runned into a strange problem, when trying to setup a serial port. The code I use to open the port:
When I execute my program i can not read or write data to the port. Then I open the serial port with PUTTY and close PUTTY. Then I execute my prpgram again, and now I can both read and write to the port. Any one that can tell me whats going on???
I have runned into a strange problem, when trying to setup a serial port. The code I use to open the port:
Code:
// Opening the Port "COM1"
hComm = CreateFile( "COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
// DCB Settings (Baudrate, parity, numBits, stopBit)
FillMemory(&dcb, sizeof(dcb), 0);
dcb.DCBlength = sizeof(dcb);
BuildCommDCB("57600,n,8,1", &dcb);
// Communications time-outs
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.ReadTotalTimeoutConstant = 0;
timeouts.WriteTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = 0;
SetCommTimeouts(hComm, &timeouts);
Comment