Hi,
I am running the serial communication program in window mobile 5 pocket pc.
the configuration setting is below:
DCB PortDCB;
PortDCB.BaudRate = 115200;
PortDCB.fBinary = TRUE;
PortDCB.fParity = TRUE;
PortDCB.fOutxCtsFlow = FALSE;
PortDCB.fOutxDsrFlow = FALSE;
PortDCB.fDtrControl = DTR_CONTROL_DISABLE;
PortDCB.fDsrSensitivity = FALSE;
PortDCB.fTXContinueOnXoff = TRUE;
PortDCB.fOutX = FALSE;
PortDCB.fInX = FALSE;
PortDCB.fErrorChar = FALSE;
PortDCB.fNull = FALSE;
PortDCB.fRtsControl = RTS_CONTROL_DISABLE;
PortDCB.ByteSize = ByteSize;
PortDCB.Parity = NOPARITY;
PortDCB.StopBits = ONESTOPBIT;
PortDCB.fAbortOnError = FALSE;
The timeout setting is :
COMMTIMEOUTS commTimeouts;
commTimeouts.ReadIntervalTimeout = MAXDWORD;
commTimeouts.ReadTotalTimeoutMultiplier = 0;
commTimeouts.ReadTotalTimeoutConstant = 0;
commTimeouts.WriteTotalTimeoutMultiplier = 10;
commTimeouts.WriteTotalTimeoutConstant = 100;
I call the writefile api as follow:
BYTE sendData = 65;
INT bytesWritten = 0;
if (!ClearCommError( portHandle, &lpErrors, &lpStat))
{
//clearcommerror failed
}
if( !(WriteFile( portHandle, &sendData,1,&bytesWritten,NULL)))
{
//error
}
else
{
//success
}
When I call the writeFile api, I got success statement but the value of
bytesWriteen is zero.
I tested in emulator and it works fine. The problem occurs in real target.
I don't really understand what happens with the WriteFile or configuration.
Can anyone help me?
Really thanks.