CHAPTER 1 (CONT…)
Number Systems, Operations, and Codes
Slide 1
1. Number Systems
1.1 Decimal Numbers
Slide 2
1.2 Binary Numbers
Slide 3
• Conversion
2.1 Binary to Decimal Conversion
• Convert binary to decimal by summing the
positions that contain a 1.
1 0 0 1 0 1 2
2 + 2 + 2 + 2 + 2 + 2 = 32 + 4 + 1 = 3710
5 4 3 2 1 0
Slide 4
2.2 Decimal to Binary Conversion
Slide 5
Decimal to Binary Conversion (cont…)
3710 = 2 + 0 + 0 + 2 + 0 + 2
5 2 0
1 0 0 1 0 12
Slide 6
Decimal to Binary Conversion (cont…)
Slide 7
Decimal to Binary Conversion (cont…)
• Repeated division –
This flowchart
describes the
process and can be
used to convert from
decimal to any other
number system.
Slide 8
3. Hexadecimal Number System
• Decimal, binary, and hexadecimal
numbers
Slide 9
Hexadecimal Number System (cont….)
Slide 10
Hexadecimal Number System (cont….)
Slide 11
Hexadecimal Number System (cont….)
Slide 12
Hexadecimal Number System (cont….)
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
9F216 = 9 F 2
1001 1111 0010 = 1001111100102
Slide 13
Hexadecimal Number System (cont….)
Slide 14
Hexadecimal Number System (cont….)
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Slide 16
4. Binary Coded Decimal (BCD)
Slide 17
Binary Coded Decimal (cont…)
Slide 18
Binary Coded Decimal (cont…)
• To convert the number 87410 to BCD:
8 7 4
0100 0111 0100 = 010001110100BCD
Slide 19
Binary Coded Decimal (cont…)
Slide 20
5. Digital Codes
• Gray code:
The gray code is
used in applications
where numbers
change rapidly.
In the gray code,
only one bit changes
from each value to
the next.
Slide 21
Digital Codes (cont…)
Slide 22
Digital Codes (cont…)
• ASCII code (control characters)
Slide 23
Digital Codes (cont…)
• ASCII code (graphic symbols 20h – 3Fh)
Slide 24
Digital Codes (cont…)
• ASCII code (graphic symbols 40h – 5Fh)
Slide 25
Digital Codes (cont…)
• ASCII code (graphic symbols 60h – 7Fh)
Slide 26
Digital Codes (cont…)
Extended ASCII code (80h – FFh)
• Non-English alphabetic characters
• Currency symbols
• Greek letters
• Math symbols
• Drawing characters
• Bar graphing characters
• Shading characters
Slide 27
6. Putting It All Together
Decimal Binary Hexadecimal BCD Gray
0 0 0 0 0
1 1 1 0001 0001
2 10 2 0010 0011
3 11 3 0011 0010
4 100 4 0100 0110
5 101 5 0101 0111
6 110 6 0110 0101
7 111 7 0111 0100
8 1000 8 1000 1100
9 1001 9 1001 1101
10 1010 A 0001 0000 1111
11 1011 B 0001 0001 1110
12 1100 C 0001 0010 1010
13 1101 D 0001 0011 1011
14 1110 E 0001 0100 1001
15 1111 F 0001 0101 1000
Slide 28
7. Complements of Binary Numbers
• 1’s complements
• 2’s complements
Slide 29
Complements of Binary Numbers (cont…)
• 1’s complement
Slide 30
Complements of Binary Numbers (cont…)
• 2’s complement
Slide 31
8. Signed Numbers
• Signed-magnitude form
• 1’s and 2’s complement form
• Decimal value of signed numbers
• Range of values
• Floating-point numbers
Slide 32
Signed Numbers (cont…)
• Signed-magnitude form
Slide 33
Signed Numbers (cont…)
Slide 34
Signed Numbers (cont…)
• Range of Values
2’s complement form:
– (2n – 1) to + (2n – 1 – 1)
Slide 35
Signed Numbers (cont…)
• Floating-point numbers
– Single-precision (32 bits)
– Double-precision (64 bits)
– Extended-precision (80 bits)
Slide 36
8.1 Arithmetic Operations with
Signed Numbers
• Addition
• Subtraction
• Multiplication
• Division
Slide 37
Arithmetic Operations with Signed
Numbers (cont…)
Addition of Signed Numbers
• The parts of an addition function are:
– Addend
– Augend
– Sum
Slide 38
Arithmetic Operations with Signed
Numbers (cont…)
Four conditions for adding numbers:
• Both numbers are positive.
• A positive number that is larger than a
negative number.
• A negative number that is larger than a
positive number.
• Both numbers are negative.
Slide 39
Arithmetic Operations with Signed
Numbers (cont…)
Slide 40
Arithmetic Operations with Signed
Numbers (cont…)
Slide 41
Arithmetic Operations with Signed
Numbers (cont…)
Subtraction of Signed Numbers
• The parts of a subtraction function are:
– Subtrahend
– Minuend
– Difference
Slide 42
Arithmetic Operations with Signed
Numbers (cont…)
Subtraction
• The sign of a positive or negative binary
number is changed by taking its 2’s
complement
• To subtract two signed numbers, take
the 2’s complement of the subtrahend
and add. Discard any final carry bit.
Slide 43
Arithmetic Operations with Signed
Numbers (cont…)
Multiplication of Signed Numbers
• The parts of a multiplication function
are:
– Multiplicand
– Multiplier
– Product
Multiplication is equivalent to adding a
number to itself a number of times equal to
the multiplier.
Slide 44
Arithmetic Operations with Signed
Numbers (cont…)
Slide 45
Arithmetic Operations with Signed
Numbers (cont…)
Slide 46
Arithmetic Operations with Signed
Numbers (cont…)
Division of Signed Numbers
• The parts of a division operation are:
– Dividend
– Divisor
– Quotient
Slide 47
Arithmetic Operations with Signed
Numbers (cont…)
Slide 48
9. Parity Method for Error Detection
Slide 49
Parity Method for Error Detection
(cont…)
• The parity method of error detection
requires the addition of an extra bit to a
code group.
• This extra bit is called the parity bit.
• The bit can be either a 0 or 1, depending
on the number of 1s in the code group.
• There are two methods, even and odd.
Slide 50
Parity Method for Error Detection
(cont…)
• Even parity method – the total
number of bits in a group including
the parity bit must add up to an even
number.
– The binary group 1 0 1 1 would require
the addition of a parity bit 1 1 0 1 1
• Note that the parity bit may be added at
either end of a group.
Slide 51
Parity Method for Error Detection
(cont…)
Slide 52
Parity Method for Error Detection
(cont…)
• The transmitter and receiver must
“agree” on the type of parity checking
used.
• Two bit errors would not indicate a
parity error.
• Both odd and even parity methods are
used, but even seems to be used
more often.
Slide 53
Parity Method for Error Detection (cont…)
• Parity error codes
Slide 54
Parity Method for Error Detection (cont…)
0000000 0
0000111 1
• Hamming error codes 0011011 2
– Hamming code words 0011110 3
0101010 4
– Hex equivalent of the 0101101 5
data bits 0110011 6
0110100 7
1001011 8
1001100 9
1010010 A
1010101 B
1100001 C
1100110 D
1111000 E
1111111 F
Slide 55