If you receive some information, how do you know if it’s intact or has been changed?

Let me make this point clear from the beginning. Error detection only lets you detect errors. It doesn’t correct them. You have to provide other means to fix any errors. Usually this just means trying again.

Let’s start with a simple example. You want to send two binary bits and they’re both zeros. What possible results can you expect?

Well, first of all, you might actually get what was sent. But how do you know that it’s correct? What if you receive 01 instead? Was that what was sent? What if you only receive a single 0? Or maybe you get 001? Or maybe you get four zeros? There’s lots of possibilities. I’m going to ignore cases where you receive a different number of bits than what was sent. These cases will usually be detected just because you should know ahead of time how many bits to expect.

What I’m going to describe here is not perfect. But it’s simple and fast. It’s called parity. There’s actually two ways you can calculate parity. One’s called even parity and the other is called odd parity. These names come from even and odd numbers.

Parity works by including an extra bit for a small fixed number of data bits. You probably won’t include a parity bit for every two data bits like I started the example with. Instead, you might want to include a parity bit for every byte or eight bits. This means that if you want to send a parity bit for every eight data bits, then you’ll really be sending and receiving nine bits instead of eight.

The other option is to take a data bit away. Maybe you need to send information through a connection that can only support a fixed number of bits. You can’t just add an extra bit. So instead, what you do is devote one of the bits as the parity bit. This leaves you with one fewer bits to use for your actual data.

Okay, so how does parity actually work? It sets or clears the parity bit in order to make the total number of bits with the value of 1 be either even or odd. Setting a bit just means to make its value one. And clearing a bit just means to make its value zero.


What's on your mind?
On a scale of 0 to 10, how likely are you to refer us to friends?