Holooly Plus Logo

Question 6.6: Determine the 12-bit linear code, the eight-bit compressed c......

Determine the 12-bit linear code, the eight-bit compressed code, the decoded 12-bit code, the quantization error, and the compression error for a resolution of 0.01 V and analog sample voltages of (a) +0.053 V, (b) −0.318 V, and (c) +10.234 V

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

a. To determine the 12-bit linear code, simply divide the sample voltage by the resolution, round off the quotient, and then convert the result to a 12-bit sign-magnitude code:

\frac{+0.053\, V}{+0.01 \,V} = +5.3, which is rounded off to 5 producing a quantization error
Q_{e} = 0.3(0.01 V) = 0.003 V

\begin{matrix}&&&&&&&&&&&&&&&&&&&&\mathrm{\qquad A\,\,\, B\,\, \,C\,\, D} \end{matrix}\\ \begin{matrix}\text{12-bit linear code}=\,\,\underset{\substack{ \\ {}\big\downarrow \\\\[0.1 cm] \text{sign bit}\\[0.1cm] (1\,=\,+)}}{1} \qquad\underset{\substack{\\[0.1 cm]\xleftarrow[{\qquad\qquad\qquad}]{{}}\xrightarrow [{\qquad\qquad\qquad}]{{}}\\ \text{11-bit magnitude bits 00000000101 = 5}}}{0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,1\,\,\,\,0\,\,\,\,1} \end{matrix} \text{To determine the 8-bit}\quad\qquad\begin{matrix} 1\quad \underline{0 \quad0 \quad0 \quad0 \quad0\quad0 \quad0}\quad \underline{0 \quad1 \quad0 \quad1}\end{matrix} \text{compressed code,}\quad\qquad\qquad\ \ \! \begin{matrix} 1 \qquad \!\!\qquad \small\text{(7 – 7 = 0)} \qquad \qquad \mathrm{\, A\quad B\quad\!\, C\quad\!\, D} \end{matrix} \quad\qquad\qquad\qquad\qquad\qquad\qquad\begin{matrix} \!\!\!\substack{\text{sign}\\[0.05 cm] \text{bit}\\[0.1 cm] (+)} \qquad \qquad\!\!\substack{\text{unit}\\[0.05 cm] \text{identifier}\\[0.1 cm] \text{(segment 0)}} \qquad\quad \qquad \substack{\text{quantization}\\[0.05 cm] \text{interval}\\[0.1 cm] (5)} \end{matrix} \\[0.1 cm]\text{8-bit compressed code}\qquad=\begin{matrix} 1\qquad\qquad 0 \quad0 \quad0 \ \ \,\quad\quad\quad\quad 0 \quad1 \quad0 \quad1 \end{matrix} \text{To determine the 12-bit}\ \ \quad\quad\begin{matrix} 1\qquad\qquad \underline{0 \quad0 \quad0} \ \ \,\quad\quad\quad\quad \underline{0 \quad1 \quad0 \quad1} \end{matrix} \text{recovered code, simply}\qquad \quad\begin{matrix} \mathrm s \ \ \qquad \small\text{(000 = segment 0)} \qquad \quad \mathrm{\!\!\ A\quad B\quad\! C\quad\! D} \end{matrix} \\[0.05 cm]\substack{\normalsize\text{reverse the process:}\\[0.8 cm]{} }\ \,\qquad\qquad\begin{matrix} \!\!\!\substack{\text{sign}\\[0.1cm] \text{bit}\\[0.1 cm] (+)} \qquad \quad\substack{\text{segment 0}\\[0.1 cm] \text{has}\\[0.1 cm] \text{seven leading 0s}} \qquad\quad \qquad \substack{\text{quantization}\\[0.1 cm] \text{interval}\\[0.1 cm] (0101\, =\, 5) } \end{matrix} \text{12-bit recovered code}\ \, \quad\quad\begin{matrix} =1\quad\quad\ \ 0 \quad0 \quad0 \quad0 \quad0\quad0 \quad0\quad 0 \quad1 \quad0 \quad1\,=\,+5\end{matrix} \text{recovered voltage}\qquad\qquad\!=+5(0.01)=+0.05

As Example 6 shows, the recovered 12-bit code (+5) is exactly the same as the original 12-bit linear code (+5). Therefore, the decoded voltage (+0.05 V) is the same as the original encoded voltage (+0.5). This is true for all codes in segments 0 and 1. Thus, there is no compression error in segments 0 and 1, and the only error produced is from the quantizing process (for this example, the quantization error Q_{e} = 0.003 V).

b. To determine the 12-bit linear code,

\frac{-0.318\, V}{+0.01 \,mV} = −31.8, which is rounded off to −32, producing a
quantization error Q_{e} = −0.2 (0.01 V) = −0.002 V

\begin{matrix}&&&&&&&&&&&&&&&&&&&&\mathrm{\ \ \ \ \,\,A\,\, B\,\,\, C\,\, \,D} \end{matrix}\\ \begin{matrix}\text{12-bit linear code}=\,\,\underset{\substack{ \\ {}\big\downarrow \\\\[0.1 cm] \text{sign bit}\\[0.1cm] (0=-)}}{0} \qquad\underset{\substack{\\[0.1 cm]\xleftarrow[{\,\qquad}]{{}}\text{11-bit magnitude bits}\,\,\xrightarrow [{\,\qquad}]{{}}}}{0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,1\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0\,\,\,\,0} \end{matrix} \text{To determine the 8-bit}\quad\qquad\begin{matrix} 0\quad \underline{0 \quad0 \quad0 \quad0 \quad0}\quad1 \qquad\quad \underline{0 \quad0 \quad0 \quad0} \quad0 \end{matrix} \text{compressed code,}\quad\qquad\qquad\,\,\begin{matrix} 0 \qquad \!\!\qquad \small\text{(7 – 5 = 2)} \qquad \qquad \mathrm{\ \ A\quad B\quad\!\, C\quad\!\, D\quad\!\, X} \end{matrix} \quad\qquad\qquad\qquad\qquad\qquad\qquad\begin{matrix} \!\!\!\substack{\text{sign}\\[0.05 cm] \text{bit}\\[0.1 cm] (-)} \qquad \qquad\!\!\substack{\text{unit}\\[0.05 cm] \text{identifier}\\[0.1 cm] \text{(segment 2)}} \qquad\quad \qquad \substack{\text{quantization}\\[0.05 cm] \text{interval}\\[0.1 cm] (0)} \quad\,\, \substack{\text{truncated}\\[0.4 cm]{} } \end{matrix} \\[0.1 cm]\text{eight-bit compressed code}\ \!=\,\, \begin{matrix} 0\qquad\qquad 0 \quad1 \quad0 \ \ \,\quad\quad\quad\quad 0 \quad0 \quad0 \quad0 \end{matrix} \text{Again, to determine}\qquad\qquad\ \begin{matrix} 0\qquad\qquad \underline{0 \quad1 \quad0} \ \ \,\quad\quad\quad\quad \underline{0 \quad0 \quad0 \quad0} \end{matrix} \text{the 12-bit recovered}\quad\qquad\qquad\begin{matrix} \qquad \!\!\qquad \small\text{(7 – 2 = 5)} \qquad \qquad \mathrm{\ \ A\quad B\quad\! C\quad\! D} \end{matrix} \\[0.05 cm]\substack{\normalsize\text{code, simply reverse}\\[0.07 cm] \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\normalsize\text{the process:}\\[0.25 cm]{} }\ \,\qquad\qquad\begin{matrix} \!\!\!\substack{\text{sign}\\[0.1cm] \text{bit}\\[0.1 cm] (-)} \qquad \qquad\substack{\text{segment 5}\\[0.1 cm] \text{has five}\\[0.1 cm] \text{leading 0s}} \qquad\quad \qquad \substack{\text{quantization}\\[0.1 cm] \text{interval}\\[0.1 cm] (0000\, = \,0) } \end{matrix} \begin{matrix}&&&&&&&&&&&&&&&&&&&&&&&&&\mathrm{\ \ \!A\ \ \,\ B\ \,\ C\ \ \,D} \end{matrix}\\ \begin{matrix}\text{12-bit recovered code}\quad\quad\ =\underset{\substack{ \\ {}\big\uparrow \\\\[0.1 cm] \text{s}}}{0} \qquad\ \ \ \ \underline{0\quad0\quad0\quad0\quad0}\underset{\substack{ \\ {}\big\uparrow \\\\[0.1 cm] \text{inserted}}}{1}\underline{0\quad0\quad0\quad0}\underset{\substack{ \\ {}\big\uparrow \\\\[0.1 cm] \text{inserted}}}{1}\ = -33 \end{matrix}\\\text{decoded voltage}\quad\!\!\quad\quad\quad\quad=-33(0.1) =-0.33 \,V

Note the two inserted ones in the recovered 12-bit code. The least significant bit is determined from the decoding table shown in Figure 18c. As the figure shows, in the receiver the most significant of the truncated bits is always set (1), and all other truncated bits are cleared (0s). For segment 2 codes, there is only one truncated bit; thus, it is set in the receiver. The inserted 1 in bit position 6 was dropped during the 12-bit-to-8-bit conversion process, as transmission of this bit is redundant because if it were not a 1, the sample would not be in that segment. Consequently, for all segments except segments 0 and 1, a 1 is automatically inserted between the reinserted 0s and the ABCD bits.

For this example, there are two errors: the quantization error and the compression error. The quantization error is due to rounding off the sample voltage in the encoder to the closest PCM code, and the compression error is caused by forcing the truncated bit to be a 1 in the receiver. Keep in mind that the two errors are not always additive, as they could cause errors in the opposite direction and actually cancel each other. The worst-case scenario would be when the two errors were in the same direction and at their maximum values. For this example, the combined error was 0.33 V − 0.318 V = 0.012 V. The worst possible error in segments 0 and 1 is the maximum quantization error, or half the magnitude of the resolution. In segments 2 through 7, the worst possible error is the sum of the maximum quantization error plus the magnitude of the most significant of the truncated bits.

c. To determine the 12-bit linear code,

\frac{+10.234\,V}{+0.01\,V}= + 1023.4, which is rounded off to 1023, producing a
quantization error Q_{e} = −0.4(0.01 V) = −0.004 V

\qquad\qquad\begin{matrix}&&&&&&&&&&&&&&&\mathrm{\ \ \ A\ \ \ B\ \ \ C\ \ \ D} \end{matrix}\\ \qquad\qquad\begin{matrix}\text{12-bit linear code}=\ \ \underset{\substack{ \\ {}\big\downarrow \\\\[0.1 cm] \text{sign bit}\\[0.1cm] (1\,=\,+)}}{1} \quad\underset{\substack{\\[0.1 cm]\xleftarrow[{\qquad\qquad}]{{}}\text{11-bit magnitude bits}\,\,\xrightarrow [{\qquad \qquad}]{{}}}}{0\quad1\quad1\quad1\quad1\quad1\quad1\quad1\quad1\quad1\quad1} \end{matrix} \text{To determine the 8-bit}\ \,\qquad\qquad\begin{matrix} 1\qquad 0 \quad1 \quad\underline{1 \quad1 \quad1\quad1}\quad 1 \quad1 \quad1 \quad1 \quad1 \end{matrix} \text{compressed code,}\ \ \quad\ \quad\qquad\qquad\begin{matrix}1\quad\qquad\qquad\! \text{A} \quad\! \text{B} \quad\! \text{C} \quad \!\!\text{D}\quad \!\text{X}\quad \!\!\text{X} \quad\!\text{X} \quad\!\!\text{X} \!\quad\text{X} \end{matrix} \qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\ \small\text{truncated} \text{8-bit compressed code}\quad=\quad\quad\ \begin{matrix}1\qquad \,1 \quad 1 \quad 0 \quad1\quad 1\quad1 \quad1 \end{matrix} \text{To determine the 12-bit}\quad\ \, \ \, \quad\quad\begin{matrix}1\qquad \ \underline{ 1 \quad 1 \quad 0} \quad\underline{1\quad 1\quad1 \quad1} \end{matrix} \text{recovered code, simply}\quad\ \, \ \quad\quad\ \ \ \begin{matrix}\mathrm s\qquad \small\text{segment 6} \quad \text{A} \quad \text{B} \quad\! \text{C} \quad \!\!\text{D} \end{matrix} \begin{matrix}\text{12-bit recovered code}\qquad\ =\qquad\!\!\!\!\underset{\substack{ \\[0.7 cm] \text{s}}}{1} \quad 0\underset{\substack{ \\ {}\big\uparrow \\\\[0.1 cm] \text{inserted}}}{1}\underset{\substack{\!\mathrm{A \quad B\quad C \quad D}}}{\underline{1\quad1\quad1\quad1}}\underset{\substack{ \\ {}\big\uparrow \\\\[0.1 cm] \text{inserted}}}{1}0\quad0\quad0\quad0\quad+1008 \end{matrix} \text{decoded voltage}\quad\quad\quad\quad\ \,=+1008(0.01) =+10.08 \,V

The difference between the original 12-bit code and the decoded 12-bit code is

\qquad\qquad\qquad\qquad\qquad10.23 − 10.08 = 0.15

\qquad\qquad\qquad\qquad\qquad 1011\, 1111 \,1111

or \ \qquad\qquad\quad\qquad\!\!\qquad \underline{1011\, 1111 \,0000}
\ \qquad\qquad\qquad\qquad\qquad\qquad\qquad 1111\quad=\ 15(0.01)=0.15\,V

For this example, there are again two errors: a quantization error of 0.004 V and a compression error of 0.15 V. The combined error is 10.234 V − 10.08 V = 0.154 V.

ch6_figure_18

Related Answered Questions