SerialPort.SetParity
--------------------

Sets parity setting.

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

MBS( "SerialPort.SetParity"; PortReference; Value ) 

**MBS**( **"SerialPort.SetParity";** /\* Sets parity setting. \*/  
**$PortReference**; /\* The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port.e.g. $port \*/   
**$Value**) /\* The new parity setting.e.g. 1 \*/ 

### 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 |
| Value | The new parity setting. | 1 |

### Result

Returns OK or error.

### Description

Sets parity setting.  
Can be 0 (off), 1 (odd) or 2 (even)  
### Examples

Sets partity to none:

 MBS ("SerialPort.SetParity"; 28001; 0)  
Sets partity to odd:

 MBS ("SerialPort.SetParity"; 28001; 1)  
Sets partity to even:

 MBS ("SerialPort.SetParity"; 28001; 2)  
### See also

- [SerialPort.GetParity](SerialPortGetParity.md)
- [SerialPort.Open](SerialPortOpen.md)
- [SerialPort.SetDataBits](SerialPortSetDataBits.md)
- [SerialPort.SetTag](SerialPortSetTag.md)

This function is free to use.

Created 6th February 2015 , last changed 6th February 2015

  
[SerialPort.SetDataBits](SerialPortSetDataBits.md) - [SerialPort.SetRTS](SerialPortSetRTS.md)

[HTML Version](SerialPortSetParity.shtml)