Question 6.18: Assume that we have 4 bytes of hexadecimal data: 25H, 62H, 3...
Assume that we have 4 bytes of hexadecimal data: 25H, 62H, 3FH, and 52H.(a) Find the checksum byte, (b) perform the checksum operation to ensure data integrity, and (c) if the second byte 62H has been changed to 22H, show how checksum detects the error.
Learn more on how we answer questions.
(a) Find the checksum byte.
\begin{array}{r c}\begin{matrix} \\ \\ \end{matrix} \begin{matrix} 25H \\ + 62H \\ + 3FH \\ + 52H \\ \hline 118H \end{matrix} \end{array}The checksum is calculated by first adding the bytes. The sum is 118H, and dropping the carry, we get 18H. The checksum byte is the 2’s complement of 18H, which is E8H
(b) Perform the checksum operation to ensure data integrity.
\begin{array}{r c}\begin{matrix} \\ \\ \end{matrix} \begin{matrix} 25H \\ + 62H \\ + 3FH \\ + 52H \\ + E8H \\ \hline 200H \end{matrix} \begin{matrix} \\ \\ \\ \\ \\ \text{(dropping the carries) } \end{matrix} \end{array}Adding the series of bytes including the checksum byte must result in zero. This indicates that all the bytes are unchanged and no byte is corrupted.
(c) If the second byte 62H has been changed to 22H, show how checksum detects the error.
\begin{array}{r c}\begin{matrix} \\ \\ \end{matrix} \begin{matrix} 25H \\ + 22H \\ + 3FH \\ + 52H \\ + E8H \\ \hline 1C0H \end{matrix} \begin{matrix} \\ \\ \\ \\ \\ \text{(dropping the carry, we get C0H)} \end{matrix} \end{array}Adding the series of bytes including the checksum byte shows that the result is not zero, which indicates that one or more bytes have been corrupted.