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:
If used, the parity bit is located between the last data bit and first stop bit of a serial frame.