# Parity Bit Calculation

The parity bit is calculated by doing an exclusive-or of all the data bits. If odd parity is used, the result of the exclusive or is inverted. The relation between the parity bit and data bits is as follows:

Peven=dn1d3d2d1d00
Podd=dn1d3d2d1d01
Peven
Parity bit using even parity
Podd
Parity bit using odd parity
dn
Data bit n of the character

If used, the parity bit is located between the last data bit and first stop bit of a serial frame.