94
SECTION
2
Components
and Systems
Industrial Text & Video Company 1-800-752-8398
www.industrialtext.com
CHAPTER
4
Processors, the Power Supply,
and Programming Devices
Let’s suppose that a processor transmits the 7-bit ASCII character C
(1000011) to a peripheral device and odd parity is required. The total number
of 1s is three, or odd. If the parity bit (P) is the most significant bit, the
transmitted data will be P1000011. To achieve odd parity, P is set to 0 to obtain
an odd number of 1s. The receiving end detects an error if the data does not
contain an odd number of 1s. If even parity had been the error-checking
method, P would have been set to 1 to obtain an even number of 1s.
Parity error checking is a single-error detection method. If one bit of data in
a word changes, an error will be detected due to the change in the bit pattern.
However, if two bits change value, the number of 1s will be changed back, and
an error will not be detected even though there is a mistransmission.
In PLCs, when data is transmitted to a subsystem, the controller defines the
type of parity (odd or even) that will be used. However, if the data
transmission is from the programmable controller to a peripheral, the parity
method must be prespecified and must be the same for both devices.
Some processors do not use parity when transmitting information, although
their peripherals may require it. In this case, parity generation can be
accomplished through application software. The parity bit can be set for odd
or even parity with a short routine using functional blocks or a high-level
language. If a nonparity-oriented processor receives data that contains parity,
a software routine can also be used to mask out, or strip, the parity bit.
Checksum. The extra bit of data added to each word when using parity error
detection is often too wasteful to be desirable. In data storage, for example,
error detection is desirable, but storing one extra bit for every eight bits means
a 12.5% loss of data storage capacity. For this reason, a data block error-
checking method known as checksum is used.
Checksum error detection spots errors in blocks of many words, instead of in
individual words as parity does. Checksum analyzes all of the words in a data
block and then adds to the end of the block one word that reflects a
characteristic of the block. Figure 4-17 shows this last word, known as the
block check character (BCC). This type of error checking is appropriate for
memory checks and is usually done at power-up.
There are several methods of checksum computation, with the three most
common being:
• cyclic redundancy check
• longitudinal redundancy check
• cyclic exclusive-OR checksum
Cyclic Redundancy Check. Cyclic redundancy check (CRC) is a technique
that performs an addition of all the words in the data block and then stores the
resulting sum in the last location, the block check character (BCC). This