The DCB for a serial port supports (as standard) the below
BaudRate
Specifies the baud rate at which the communication device operates.
It is an actual baud rate value, or one of the following baud rate indexes:
...
CBR_1200
CBR_2400
...
Thus the code below (from the MSDN)
DCB PortDCB;
// Initialize the DCBlength member. PortDCB.DCBlength = sizeof (DCB);
// Get the default port setting information. GetCommState (hPort, &PortDCB);
// Change the DCB structure settings. PortDCB.BaudRate = 9600; // Current baud PortDCB.fBinary = TRUE; // Binary mode; no EOF check PortDCB.fParity = TRUE; // Enable parity checking PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control PortDCB.fDtrControl = DTR_CONTROL_ENABLE; // DTR flow control type PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx PortDCB.fOutX = FALSE; // No XON/XOFF out flow control PortDCB.fInX = FALSE; // No XON/XOFF in flow control PortDCB.fErrorChar = FALSE; // Disable error replacement PortDCB.fNull = FALSE; // Disable null stripping PortDCB.fRtsControl = RTS_CONTROL_ENABLE; // RTS flow control PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on // error PortDCB.ByteSize = 8; // Number of bits/byte, 4-8 PortDCB.Parity = NOPARITY; // 0-4=no,odd,even,mark,space PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2
// Configure the port according to the specifications of the DCB // structure. if (!SetCommState (hPort, &PortDCB)) { // Could not configure the serial port. dwError = GetLastError (); MessageBox (hMainWnd, TEXT("Unable to configure the serial port"), TEXT("Error"), MB_OK); return FALSE; }
In theory then you should be able to replace
PortDCB.BaudRate = 9600; // Current baud
with
PortDCB.BaudRate = 1350; // Current baud
and it may work. It all depends if the clock rate divider will actually produce that baud rate output.
The DCB for a serial port supports (as standard) the below
BaudRate
It is an actual baud rate value, or one of the following baud rate indexes:
...
...
Thus the code below (from the MSDN)
DCB PortDCB;
// Initialize the DCBlength member.
PortDCB.DCBlength = sizeof (DCB);
// Get the default port setting information.
GetCommState (hPort, &PortDCB);
// Change the DCB structure settings.
PortDCB.BaudRate = 9600; // Current baud
PortDCB.fBinary = TRUE; // Binary mode; no EOF check
PortDCB.fParity = TRUE; // Enable parity checking
PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control
PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control
PortDCB.fDtrControl = DTR_CONTROL_ENABLE;
// DTR flow control type
PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity
PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx
PortDCB.fOutX = FALSE; // No XON/XOFF out flow control
PortDCB.fInX = FALSE; // No XON/XOFF in flow control
PortDCB.fErrorChar = FALSE; // Disable error replacement
PortDCB.fNull = FALSE; // Disable null stripping
PortDCB.fRtsControl = RTS_CONTROL_ENABLE;
// RTS flow control
PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on
// error
PortDCB.ByteSize = 8; // Number of bits/byte, 4-8
PortDCB.Parity = NOPARITY; // 0-4=no,odd,even,mark,space
PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2
// Configure the port according to the specifications of the DCB
// structure.
if (!SetCommState (hPort, &PortDCB))
{
// Could not configure the serial port.
dwError = GetLastError ();
MessageBox (hMainWnd, TEXT("Unable to configure the serial port"),
TEXT("Error"), MB_OK);
return FALSE;
}
In theory then you should be able to replace
PortDCB.BaudRate = 9600; // Current baud
with
PortDCB.BaudRate = 1350; // Current baud
and it may work. It all depends if the clock rate divider will actually produce that baud rate output.
Points: 0
You voted ‘up’
Hi,
Sorry, but the UART will not support this Baudrate.
Don Schaefer
Points: 0
You voted ‘up’
Log in to post comments