Solutions for Test_1

advertisement
國立高雄大學
數位系統導論
資訊工程學系
九十九 學年度 第二學期
平時考(一) 考試範圍: Chap. 1
1. (36%) Do the following conversion problems. Write down your answers for the
blanks (1) ~ (12) on the Answer Sheet.0
Decimal
Binary
Octal
Hexadecimal
(1)
110011001.101
(2)
(3)
409.625
631.5
199.A
(4)
(5)
472.3
(6)
314.375
1 0011 1010.011
13A.6
(7)
(8)
(9)
ADF9.C
44537.75
1010 1101 1111
126771.6
1001.1100
5324.26
(10)
(11)
(12)
1 0100 1100
12314.205
14CC.428
1100.010
Ans.
2. (10%) Perform the binary division 101110101 ÷ 1101.
Ans.
3. (10%) Represent the unsigned decimal number 842 and 537 in BCD, and then show
the steps necessary to for their sum.
Ans.
1000 0100 0010
+0101 0011 0111
--------------------1101 0111 1001
+0110 0000 0000
國立高雄大學
資訊工程學系
數位系統導論
九十九 學年度 第二學期
平時考(一) 考試範圍: Chap. 1
------------------1 0011 0111 1001
4. (10%) What is the percentage of power consumed for continuous counting (either up
or down but not both) at the output of a binary Gray code counter (with 2 n code words
used) compared to a binary counter suppose the bits length n = 8.
Ans.
Following the procedure below and let n=8, you can get the answer.
5. (26%) Gray code is applied to optical shaft-angle encoder in the textbook as an
example. The Binary coding and Gray coding for the shaft position are shown in the
Fig. 1 (a) and (b), respectively. (A) Finish the Gray coding in (b) by filling in the
blanks (1) ~ (9) (B) Explain why the Gray code you have assigned avoids the
reporting of major error in shaft position as the Binary code will occur.
國立高雄大學
資訊工程學系
九十九 學年度 第二學期
數位系統導論
平時考(一) 考試範圍: Chap. 1
111
000
(8)
(1)
B0
00
B1
110
(7)
001
B2
(2)
G
(6)
010
101
100
011
G0
G2
1
(3)
(5)
(4)
(b) Gray Code for Positions 0 through 7
(a) Binary Code for Positions 0 through 7
Fig. 1 Figure for Problem 5
Ans.
(A)
100
000
101
001
G
G
111
G
2
1
0
110
011
010
(B) There will be some errors when it is encoded in Binary code. For example, suppose
that the shaft and disk are positioned so that the sensors lie right at the boundary between
011 and 100. In this case, sensors in position B2, B1 and B0 have the light partially
blocked. In such a situation, it is unclear whether the three sensors will see light or dark.
As a consequence, each sensor may produce either a 1 or 0. Thus, the resulting encoded
binary number for a value between 3 and 4 may be 000, 001, 010, 011, 100, 101, 110, or
111. Either 011 or 100 will be satisfactory, but the other six values are clearly erroneous.
This problem can be solved by encoding in Gray code. Since in Gray code, only a single
bit changes when going from one value to the next or previous value, so this problem can’t
國立高雄大學
數位系統導論
資訊工程學系
九十九 學年度 第二學期
平時考(一) 考試範圍: Chap. 1
occur. For example, if the sensors lie on the boundary of 2 and 3, the resulting coding is
either 010 or 011, either of which is satisfactory.
6. (9%) Explain the following three terms: parity bit, even parity and odd parity
Ans.
A parity bit is the extra bit included the total numbers of 1s in the resulting code word
either even or odd.
It is called even parity (odd parity), if the extra bit is used in the most significant
position of the code to produce an even (odd) number of 1s.
Download