10 years, 9 months ago.

Serial communication on PC

Hi..

I am writing a c++ based application ti send /receive data over serial port.

I am able to send the data from the application. But cannot receive the data sent by other COM port.

Is there any problem with flow control of COM port?

I am pasting serial port config here..

DCB dcb;

Fill in DCB: 19200 bps, 8 data bits, no parity, and 1 stop bit.

dcb.BaudRate = 19200; set the baud rate dcb.ByteSize = 8; data size, xmit, and rcv dcb.Parity = NOPARITY; no parity bit dcb.StopBits = ONESTOPBIT; one stop bit

dcb.fBinary = TRUE; dcb.fParity = TRUE; dcb.fOutxCtsFlow = FALSE; dcb.fOutxDsrFlow = FALSE; dcb.fDtrControl = DTR_CONTROL_ENABLE; dcb.fDsrSensitivity = FALSE; dcb.fTXContinueOnXoff = FALSE; dcb.fOutX = FALSE; dcb.fInX = FALSE; dcb.fErrorChar = FALSE; dcb.fNull = FALSE; dcb.fRtsControl = RTS_CONTROL_ENABLE; dcb.fAbortOnError = FALSE; comStatus = SetCommState(hCom, &dcb);

Cant locate the problem. Can anyone help?

1 Answer

10 years, 9 months ago.

The default setting for mbed is 9600 Baud. You have 19200bps = 19200 Baud. https://mbed.org/handbook/Serial