The parity bit is an error detection mechanism. Electrical interference can corrupt the transmission of data while on its way to the receiver. Fortunately, we can determine if a byte has been accurately transmitted by using the parity bit.
Using the parity will add one bit to the total length of data that is transmitted. As with the transmission speed and the stop bit, use of parity must remain consistent among both transmitter and receiver. There are different ways of detecting errors in a transmission using the parity bit.
The most common method uses the simple logic of even and odd numbers. For example, if the parity is set to ‘even’, the number of bits whose value is ‘1’ is counted. If the total number of ‘1’s in the set is even, then the parity bit is given the binary value ‘0’ and if it is odd, the parity bit will be given the binary value ‘1’. Therefore, for even parity, the total number of ‘1’s in the transmitted data should always be even. If this is not the case, an error has occurred. However, this is not the most reliable method for detecting errors because errors can potentially cancel each other out.
When using parity for validating the integrity of the byte that is transmitted, remember that re-transmitting of the data is not a part of the RS-232 standard and must therefore be handled by the application layer (e.g. control system and projector).