Professional Documents
Culture Documents
CH 02
CH 02
CHAPTER 2
Number Systems, Operations, and Codes
Decimal Numbers
The decimal number system has ten digits: 0,
1, 2, 3, 4, 5, 6, 7, 8, and 9
The decimal numbering system has a base of
10 with each position weighted by a factor of
10:
2
Binary Numbers
The binary number system has two digits:
0 and 1
3
Decimal-to-Binary Conversion
Sum-of-weights method
Repeated division-by-2 method
Conversion of decimal fractions to binary
4
Binary Arithmetic
Binary addition
Binary subtraction
Binary multiplication
Binary division
5
Complements of Binary Numbers
1’s complements
2’s complements
6
Complements of Binary Numbers
1’s complement
7
Complements of Binary Numbers
2’s complement
8
Signed Numbers
Signed-magnitude form
1’s and 2’s complement form
Decimal value of signed numbers
Range of values
Floating-point numbers
9
Signed-magnitude form
The sign bit is the left-most bit in a signed
binary number
10
Complement Form
11
Decimal Value of Signed Numbers
Sign-magnitude
1’s complement
2’s complement
12
Range of Values
2’s complement form:
– (2n – 1) to + (2n – 1 – 1)
13
Floating-Point Numbers
14
Arithmetic Operations with Signed
Numbers
Addition
Subtraction
Multiplication
Division
15
Addition of Signed Numbers 1
16
Addition of Signed Numbers 2
17
Signs for Addition 1
18
Signs for Addition 2
19
Subtraction of Signed Numbers
The parts of a subtraction function are:
Subtrahend
Minuend
Difference
20
Subtraction
21
Multiplication of Signed Numbers 1
22
Multiplication of Signed Numbers 2
23
Multiplication of Signed Numbers 3
24
Division of Signed Numbers 1
25
Division of Signed Numbers 2
26
Hexadecimal Numbers 1
27
Hexadecimal Numbers 2
Binary-to-hexadecimal conversion
Hexadecimal-to-decimal conversion
Decimal-to-hexadecimal conversion
28
Binary-to-Hexadecimal Conversion
Break the binary number into 4-bit groups
29
Hexadecimal-to-Decimal Conversion
30
Decimal-to-Hexadecimal Conversion
Repeated division by 16
31
Binary Coded Decimal (BCD)
32
Digital Codes
Gray code
ASCII code
33
Gray Code
34
ASCII Code (Control Characters)
35
ASCII Code (graphic symbols 20h – 3Fh)
36
ASCII Code (graphic symbols 40h – 5Fh)
37
ASCII Code (graphic symbols 60h – 7Fh)
38
Extended ASCII Code (80h – FFh)
39
Error Detection and Correction Codes
40
Parity Error Codes
41
Hamming Error Codes
0000000 0
Hamming code words 0000111 1
0011011 2
0011110 3
Hex equivalent of the 0101010 4
0101101 5
data bits 0110011 6
0110100 7
1001011 8
1001100 9
1010010 A
1010101 B
1100001 C
1100110 D
1111000 E
1111111 F
42