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.

The blue check mark means that this solution has been answered and checked by an expert. This guarantees that the final answer is accurate.
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.

Related Answered Questions

Question: 6.8

Verified Answer:

1.     0011 0100        34H given in binary 2.    ...
Question: 6.10

Verified Answer:

MOV    P2,#00        ;clear P2 MOV    P1,#0FFH   ;...
Question: 6.15

Verified Answer:

MOV   R1,#0             ;R1 keeps number of 1s MOV...
Question: 6.13

Verified Answer:

MOV    R5,#8 AGAIN:         MOV   C,P2.7         ;...