2

Previously I was using CBR_9600 when communicating with 9600 baud devices. But there does not seem to be a CBR_28800 setting. Is it possible to set the baud rate using the DCB structure of 28800?

4

3 回答 3

3

According to MSDN, the baud rate can either be one of the defined constants (such as CBR_9600, CBR_38400, etc) or any integer value. The constants are just defined to the values, so it's not really an enumeration at all. From the link:

The baud rate at which the communications device operates. This member can be an actual baud rate value, or one of the following indexes.

于 2010-01-13T16:55:51.427 回答
2

Yes. CBR_9600 is just equal to 9600. It should be possible to plug in 28800 and it will just work.

于 2010-01-13T16:53:04.397 回答
1

Note that if you use rates other then the "standard" rates, the actual rate may differ from the target rate. In the hardware a "baud rate divisor" register divides down a master clock to achieve the desired baud rate, so a finite number of discrete values are available. However the resolution available at low rates is high; the increments get larger at low divisor values.

This can be a problem if communicating with devices that use different UART hardware and clocking than the PC, because the resultant rate differences can in extreme cases be beyond specified tolerances.

于 2010-01-13T20:53:50.383 回答