.baudrate Property

Function:

Sets/returns the baudrate "divisor value" for the selected serial port (selection is made through ser.num).

Type:

Word

Value Range:

0-65535, the default value is platform-dependent, results in 9,600bps.

See Also:

UART Mode, Serial Settings


Details

Actual baudrate is calculated as follows: (9,600 * ser.div9600) / ser.baudrate. The ser.div9600 read-only property returns the value ser.baudrate must be set to in order to obtain 9,600bps on a particular platform.

For example, if we need to achieve 38,400bps and ser.div9600 returns 12, then we need to set ser.baudrate = 3, because (9,600 * 12) / 38,400 = 3. This serves as a platform-independent baudrate calculation, as ser.div9600 will return different values for different platforms.

This property is only relevant when the serial port is in the UART mode (ser.mode = 0 — PL_SER_MODE_UART).

A tip note icon.Technically speaking, this property should be called divisor, not baudrate. We called it baudrate so that you could easily find it.


.baudrate Property

Details