Serial.Baud

From Xojo Documentation

Property (As Integer )
aSerial.Baud = newIntegerValue
or
IntegerValue = aSerial.Baud

Supported for all project types and targets.

The rate at which data will be sent and received (see the Baud Rate chart in the Notes section, below).

Notes

fa-info-circle-32.png
Changing property values does not automatically change the state of the hardware, you must call Reset or re-Open the connection in order for the change to take effect.

The “Baud” class constants can be used to get or set the Baud rate. To do this, check the value of Baud against one or more class constants. See the table in the section "Baud Rates", below.

Baud Rates

To set the Baud rate, assign the desired class constant to the Baud property. To get the baud rate, compare the value of the Baud property to the constants in this table.

Baud Rate Value Class Constant
300 0 Baud300
600 1 Baud600
1200 2 Baud1200
1800 3 Baud1800
2400 4 Baud2400
3600 5 Baud3600
4800 6 Baud4800
7200 7 Baud7200
9600 8 Baud9600
14400 9 Baud14400
19200 10 Baud19200
28800 11 Baud28800
38400 12 Baud38400
57600 13 Baud57600
115200 14 Baud115200
230400 15 Baud230400

Setting nonstandard baud rates is supported only on Windows and macOS. On macOS, the system supports arbitrary baud rates by passing the request along to the driver. If the driver supports the passed baud rate, then it is set (or approximated).

On Linux, some non-standard baud rates are possible to achieve by using the Setserial system call and setting your baud rate to a special value.

Example

The following example sets the Baud rate in the Open event of the window. The Baud rate can also be set in the IDE.

Serial1.Baud = Serial.Baud9600