On detecting the code, the receiving computer can send a
code to acknowledge and then devote full attention to monitoring the serial
input. On seeing the acknowledgment, the transmitting computer knows it??™s
OK to send the rest of the data.
0
A receiver can use error checking to verify that all data arrived correctly. Ways to
check a message for errors include parity bits, checksums, and sending duplicate
data.
As described earlier in this chapter, a parity bit in each transmitted word enables
the receiving computer to detect most errors introduced between the transmitter
and receiver. When using .NET??™s SerialPort class or other serial-port classes
or libraries for PC applications, the application only needs to select a parity
type. The software automatically calculates and places the correct parity bit in
each transmitted word and can raise an error on receiving data with incorrect
parity. Microcontroller hardware and software may require the firmware to calculate
and set or check the parity bit for each transmitted and received word.
A checksum is an error-checking value obtained by performing mathematical or
logical operations on the contents of a block of data. Applications can choose
from a variety of methods to calculate checksums.
A basic checksum calculation adds the values of the bytes in a block and uses
the lowest byte of the result as the checksum.
Pages:
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60