copyright (c) 2004 professor keith w. noe number system & codes number conversions part ii
Post on 22-Dec-2015
220 views
TRANSCRIPT
Copyright (c) 2004 Professor Keith W. Noe
Reading Assignment
Digital Design with CPLD Applications and VHDL, by Robert K. Dueck
Pages 6 through 17
Copyright (c) 2004 Professor Keith W. Noe
Objectives
Convert decimal numbers to binary, octal, & hexadecimal.
Convert binary numbers to octal, & hexadecimal.
Convert octal numbers to binary. Convert hexadecimal numbers to binary.
Upon the successful completion of this lesson, you should be able to:
Copyright (c) 2004 Professor Keith W. Noe
Number Conversions Number conversion from base 10 to
bases 2, 8, & 16 will be discussed first.
Next conversion from binary to bases 8 and 16 will be discussed.
Then we will discuss converting base 8 to binary.
Last, we will discuss converting base 16 numbers to binary.
Copyright (c) 2004 Professor Keith W. Noe
Why so many number systems? Digital & microprocessor-based
electronic circuitry use the binary number system.
Man uses the decimal number system. Because the binary number system uses
only 0 and 1, it is hard for us to work with such huge binary numbers.
Example: 1001111101110111011011102
Errors are usually the rule when working only in the binary number system.
Copyright (c) 2004 Professor Keith W. Noe
Why so many number systems? Technicians function better when
using the decimal number system. This is the number system we use
every day of our life. The octal number system (base 8)
closely resembles the decimal number system.
Copyright (c) 2004 Professor Keith W. Noe
Why so many number systems? Another number system that resembles
the decimal number system is the hexadecimal number system.
The hexadecimal or base 16 number system has 16 symbols, some of which are the first 6 letters of the alphabet.
This number system is also used with digital systems.
This system is usually referred to as Hex (short for hexadecimal).
Copyright (c) 2004 Professor Keith W. Noe
What does this mean for me?
Use all four number systems with relative ease.
Accurately convert numbers between all four number systems.
Computers and output circuits used by computers output codes using one of these four number systems.
As a technician working on digital-based circuits, you must be able to:
Copyright (c) 2004 Professor Keith W. Noe
Converting Decimal Numbers to Binary, Octal & Hex Converting decimal numbers to
any one of these number systems uses exactly the same process.
The process that you will use is repeated division with the integer portion of the decimal number being converted.
Copyright (c) 2004 Professor Keith W. Noe
Converting Decimal Numbers to Binary, Octal & Hex Use the old style of division
9 5 = 1 R 4 It is important that you use this
process as shown above. The remainders form the number
in the new number system you are converting the decimal number to.
Copyright (c) 2004 Professor Keith W. Noe
Decimal to Binary Conversion To convert a decimal number to
binary, you will repeatedly divide the decimal number by 2 keeping track of the remainders.
Be sure to keep track of the remainders as the remainders are used to form the binary equivalent number.
Copyright (c) 2004 Professor Keith W. Noe
Decimal to Binary Conversion
1 2 = 0 R 1 3 2 = 1 R 1 7 2 = 3 R 114 2 = 7 R 029 2 = 14 R 1
To read the binary equivalent of 2910, read the remainders from the top down: 11101
Copyright (c) 2004 Professor Keith W. Noe
Practice SessionPractice Converting these decimal numbers to binary:
4410
11710
14210
25510
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Answers:
4410 = 1011002
11710 = 11101012
14210 = 100011102
25510 = 111111112
Copyright (c) 2004 Professor Keith W. Noe
Decimal to Octal Conversion Use the same process that you used
when converting decimal numbers to binary.
Use the repeated division process. When converting decimal numbers to
octal, divide the decimal number by 8.
Keep track of the remainders, The remainders form the octal equivalent.
Copyright (c) 2004 Professor Keith W. Noe
Decimal to Octal Conversion
183 8 = 22 R 7 22 8 = 2 R 6 2 8 = 0 R 2
Use Repeated Division Dividing by 8
18310 = 2678
Copyright (c) 2004 Professor Keith W. Noe
Practice SessionPractice converting these decimal numbers to octal.
7910
19410
20810
25510
Copyright (c) 2004 Professor Keith W. Noe
Practice SessionAnswers
7910 = 1178
19410 = 3028
20810 = 3208
25510 = 3778
Copyright (c) 2004 Professor Keith W. Noe
Conversion of Decimal Numbers to Hexadecimal The same process is used for
converting decimal numbers to hex that is for converting decimal numbers to binary and octal.
Use the process of repeated division keeping track of the remainders.
When converting decimal numbers to hex, divide the decimal number by 16.
Copyright (c) 2004 Professor Keith W. Noe
Conversion of Decimal Numbers to Hexadecimal Do not forget, when remainders
are 10 or higher, convert the remainder to the appropriate letter of the alphabet.
10 = A, 11 = B, 12 = C, 13 = D, 14 = E, and F = 15.
Copyright (c) 2004 Professor Keith W. Noe
Decimal-to-Hexadecimal Conversion
Convert 19510 to Hexadecimal.
Copyright (c) 2004 Professor Keith W. Noe
Decimal-to-Hexadecimal Conversion
195 16 = 12 R 3 12 16 = 0 R 12 (C)
19510 = C316
Copyright (c) 2004 Professor Keith W. Noe
Practice SessionPractice converting the following decimal numbers to hexadecimal.
5710
13810
21710
25510
Copyright (c) 2004 Professor Keith W. Noe
Practice SessionSolutions
5710 = 3916
13810 = 8A16
21710 = D916
25510 = FF16
Copyright (c) 2004 Professor Keith W. Noe
Other Number Conversions There are times when it is
necessary to convert binary numbers to octal & vice versa;
Between the binary and hexadecimal numbers systems.
These conversions basically do not require math such as multiplication or division.
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Octal Conversion It is a simple process. Begin by dividing the binary
number into groups of three bits each beginning on the right.
Convert each group of three bits into its equivalent octal number from 0 to 7.
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Octal Equivalency
000 = 0
001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Octal Conversion
10111001
10 | 111 | 001 2 7 1
101110012 = 2718
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Convert the following binary numbers to octal.
011011002
101100112
001010012
111111112
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Answers
011011002 = 1548
101100112 = 2638
001010012 = 0518
111111112 = 3778
Copyright (c) 2004 Professor Keith W. Noe
Octal-to-Binary Conversion The method for converting octal
numbers to binary is similar to the method used for converting binary numbers to octal.
First, separate the octal digits. Second, write the binary
equivalent for each of the octal digits.
Copyright (c) 2004 Professor Keith W. Noe
Octal-to-Binary Conversion
2 5 38
2 | 5 | 3
10 101 011
2538 = 101010112
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Convert the following octal numbers to binary. 0378
1168
1458
2738
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Answers
0378 = 001111112
1168 = 010011102
1458 = 011001012
2738 = 101110112
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Hexadecimal Conversion Converting binary numbers to
hexadecimal is similar to the process used for converting binary numbers to octal.
When converting binary numbers to hexadecimal, divide the 8-bit binary number in-half.
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Hexadecimal Conversion After dividing the binary number in
half, write the hexadecimal equivalent for each 4-bit group.
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Hexadecimal Conversion
Binary to Hex Equivalency
0000 = 0 1000 = 8
0001 = 1 1001 = 9
0010 = 2 1010 = A
0011 = 3 1011 = B
0100 = 4 1100 = C
0101 = 5 1101 = D
0110 = 6 1110 = E
0111 = 7 1111 = F
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Hexadecimal Conversion
Convert 100111002 to Hexadecimal
Copyright (c) 2004 Professor Keith W. Noe
Binary-to-Hexadecimal Conversion
10011100
1001 | 1100 9 C
100111002 = 9C16
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Convert the following binary numbers to hexadecimal.
000010102
100111102
111100112
011111012
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Solutions
000010102 = 0A16
100111102 = 9E16
111100112 = F316
011111012 = 7D16
Copyright (c) 2004 Professor Keith W. Noe
Hexadecimal-to-Binary Conversion Converting a hexadecimal number
to binary is similar to converting an octal number to binary.
Divide the hexadecimal number into its individual numbers (symbols).
Write the binary equivalent for each symbol.
Copyright (c) 2004 Professor Keith W. Noe
Hexadecimal-to-Binary Conversion
5 C 5 | C 0101 1100
5C16 = 010111002
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Convert the following hexadecimal numbers to binary.
1B16
9416
A516
FB16
Copyright (c) 2004 Professor Keith W. Noe
Practice Session
Answers
1B16 = 000110112
9416 = 100101002
A516 = 101001012
FB16 = 111110112