SerialPort.SetBaudRate
----------------------

Sets the baud rate.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SerialPort](component_SerialPort.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "SerialPort.SetBaudRate"; PortReference; BaudRate ) 

**MBS**( **"SerialPort.SetBaudRate";** /\* Sets the baud rate. \*/  
**$PortReference**; /\* The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port.e.g. $port \*/   
**$BaudRate**) /\* The new baud rate as number.e.g. 9600 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PortReference | The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port. | $port |
| BaudRate | The new baud rate as number. | 9600 |

### Result

Returns OK or error message.

### Description

Sets the baud rate.  
### Examples

Set the baud rate to 9600:

 $r = MBS ( "SerialPort.SetBaudRate"; $PortReference ; 9600 )  
### See also

- [SerialPort.GetBaudRate](SerialPortGetBaudRate.md)
- [SerialPort.Open](SerialPortOpen.md)
- [SerialPort.Read](SerialPortRead.md)
- [SerialPort.SetDataBits](SerialPortSetDataBits.md)

### Release notes

- **Version 15.1**
    - Improved [SerialPort.SetBaudRate](https://www.mbsplugins.eu/SerialPortSetBaudRate.shtml) to not try to change if the baud rate if the old and new rate are the same.

### Blog Entries

- [MBS FileMaker Plugin, version 15.1pr1](https://www.mbsplugins.de/archive/2025-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.1pr1](https://www.mbsplugins.de/archive/2012-12-14/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 17th February 2023

  
[SerialPort.Resume](SerialPortResume.md) - [SerialPort.SetCTS](SerialPortSetCTS.md)

[HTML Version](SerialPortSetBaudRate.shtml)