SerialPort.SetDataBits
----------------------

Sets data bit size.

| 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.SetDataBits"; PortReference; Size ) 

**MBS**( **"SerialPort.SetDataBits";** /\* Sets data bit size. \*/  
**$PortReference**; /\* The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port.e.g. $port \*/   
**$Size**) /\* The new setting.e.g. 8 \*/ 

### 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 |
| Size | The new setting. | 8 |

### Result

Returns OK or error message.

### Description

Sets data bit size.  
Value can only be 5, 6, 7 or 8.  
### Examples

Set the data bits to 8:

 $r = MBS ( "SerialPort.SetDataBits"; $DeviceRef ; 8 )  
### See also

- [SerialPort.GetDataBits](SerialPortGetDataBits.md)
- [SerialPort.GetStopBits](SerialPortGetStopBits.md)
- [SerialPort.Open](SerialPortOpen.md)
- [SerialPort.SetBaudRate](SerialPortSetBaudRate.md)
- [SerialPort.SetParity](SerialPortSetParity.md)
- [SerialPort.SetStopBits](SerialPortSetStopBits.md)

### Blog Entries

- [MBS FileMaker Plugin, version 5.0pr10](https://www.mbsplugins.de/archive/2015-02-06/MBS_FileMaker_Plugin_version_5/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 18th August 2014

  
[SerialPort.SetDataAvailableHandler](SerialPortSetDataAvailableHandler.md) - [SerialPort.SetParity](SerialPortSetParity.md)

[HTML Version](SerialPortSetDataBits.shtml)