Detecting Code Errors.
Computers are very reliable,but they’re not infallible.
If just one bit in a string of 6,7,or 8 bits is lost during data input,processing,or output operations,an incorrect character code will be created.
Such an error can be caused by dust particles on storage media,by improper humidity levels near the computer,or by many other factors.
Fortunately,however,computer designers have developed a method for detecting such errors by adding an extra check bit or parity bit to each 6,7,or 8-bit character represented in storage.
Thus,as you can see in Fig. 1-7,a total of 7,8,or 9 bits may actually be stored.
The designers of a particular computer model may then use the check bit to make sure that every valid character code will always have an even number of 1 bits.
The 6-bit coding used to represent selected characters was presented earlier in Fig.1-4.
Several of these characters have been reproduced in Fig.1-8.

You’ll notice that if the basic code for a character such as 1,2,or A requires an odd number of 1 bits,an additional 1 bit is added in the check-bit location so that there will always be an even number of such bits.
This is an example of an even-parity format,but other computers use the check bit to produce an odd parity.
Since every valid character in a computer that uses even parity must always have an even number of 1 bits,circuits for parity,checking are built into the computer to constantly monitor the data moving through the system.
The computer operator is notified if a bit is lost and a parity error is detected.Of course,parity checking will only detect coding errors.
It cannot signal the fact that incorrect data have been entered into the system if the data are properly coded.
代码检错。
计算机可靠性高,但并非不会出错。在数据输入、处理或输出操作中,6位、7位或8位二进制数串即使仅有1位丢失,也会产生错误的字符代码。这样的错误可由存储介质上的灰尘微粒、计算机附近的湿度不适宜或许多其他因素造成。
不过幸运的是计算机设计者已研制了一种检测这种错误的方法,这就是对在存储器中表示的每个6位、7位或8位字符增加一个附加的检查位或奇偶检验位。这样,正如你在图1-7中所看到的,实际存储的可以是7位、8位或9位。于是,特定计算机的设计者可使用校验位来保证每个合法字符的代码总保持偶数个“1”。前面图1-4所示的是所选字符的6位编码。其中一些字符在图1-8中重新表示。注意,如果像1、2或A这样的字符的基本代码有奇数个“l”,那么就要在检验位上加一个“l”,使得代码总保持偶数个“l”。这是一个偶检验的例子,而其他计算机也可使用检验位生成奇检验。因为计算机中使用偶检验时,合法字符总有偶数个“1”,所以计算机中装入了奇偶检验检测电路,经常监测系统中移动的数据。如果有位丢失,就会检测到奇偶检验错,并通知计算机操作人员。当然,奇偶检验只能检测编码
错。它不能告知数据编码正确但输入数据本身出错的情况。