Download presentation
Presentation is loading. Please wait.
1
ECE456: Number Systems (review)
Xing - Fall09 ECE456: Number Systems (review) Instructor: Dr. Honggang Wang II-209B, ECE Dept., Fall 2013 Background Review Lecture
2
Administrative Issues (9/16/13)
Xing - Fall09 Administrative Issues (9/16/13) Project team set-up due Wednesday, Sept. 25 If you missed the first class, go to the course website for syllabus and 1st lecture. Dr. Wang Background Review Lecture
3
1 Mega bytes = 2? bytes 26 bytes (x) 217 bytes (x) 1024 bytes (x)
Xing - Fall09 1 Mega bytes = 2? bytes 26 bytes (x) 217 bytes (x) 1024 bytes (x) 216 bytes (x) 1E7 bytes (x) 210 bytes (x) 232 bytes (x) No answer (x) 21 responses From Background Survey Dr. Wang Background Review Lecture
4
Number Systems Do you know the equivalent hexadecimal, octal, and decimal values of the binary number ? What is the equivalent binary number of the decimal number 63? From Background Survey Dr. Wang
5
Xing - Fall09 Conventions Term Normal Usage Usage as a Power of 2 Kilo (K) 103 210 =1,024 Mega (M) 106 220 =1,048,576 Giga (G) 109 230 =1,073,741,824 Tera (T) 1012 240 =1,099,511,627,776 Mili (m) 10-3 Micro (m) 10-6 Nano (n) 10-9 Pico (p ) 10-12 Powers of 2 are most often used in describing memory capacity. Ex: 1Kilobyte (KB) =1024 bytes= 210 bytes Powers of 10 are used to describe the CPU clock frequencies: cycles per second (Hz) Ex: Pentium GHz = 1.8x109 Hz Dr. Wang Background Review Lecture
6
Definitions Term Definition bit 0 or 1 byte (B) a group of 8 bits
Xing - Fall09 Definitions Term Definition bit 0 or 1 byte (B) a group of 8 bits nibble (nybble) half a byte (4 bits) word (w) a group of bits that is processed simultaneously. a word may consist of 8/16/32/other number of bits machine dependent (ex: 8086 – 16 bits; 80386/80486/Pentium – 32 bits) double word 2 words msb (most significant bit) the leftmost bit in a word lsb (least significant bit) the rightmost bit in a word Hz (hertz) reciprocal of second Dr. Wang Background Review Lecture
7
Review of Number Systems
Xing - Fall09 Review of Number Systems Overview Number systems conversions Chapter 19 (online chapter) Or Appendix A in 7th edition We study the number systems that C programmers use. Dr. Wang Background Review Lecture
8
Number Systems Two basic types of number systems: Non-positional
Xing - Fall09 Number Systems Two basic types of number systems: Non-positional Ex: Roman numerals: I, II, III, IV, V … X, XI … C Normally only useful for small numbers Positional Ex: the decimal systems Each position in which a digit/symbol is written has a different positional value, which is a power of the base Dr. Wang Background Review Lecture
9
Positional Number Systems (Example)
Xing - Fall09 Positional Number Systems (Example) Decimal number systems a base of 10 (determines the magnitude of a place). is restricted to 10 re-usable digits/symbols (0,1,2,3,4,5,6,7,8,9) the value of a digit depends on its position (digit x positional value = digit x baseposition) sum of the value of all digits gives the value of the number. 58710 = 5 x x x 100 = 5 x x x 1 = = 587 The positional value is a power of the base and the powers begin at 0 and increase by 1 as we move left in the number. Explain, 10 is the base, power is determined by the position of the symbol or digit, the digit value is obtained by multiply the digit and the positional value! Dr. Wang Background Review Lecture
10
Positional Number Systems
Xing - Fall09 Positional Number Systems Decimal (base is 10): = 3 x x x x x 10-2 = 3 x x x x x 0.01 = = In general (base is b), N = ...P3P2P1P0 . P-1P-2P-3... = P3b3 + P2b2 + P1b1 + P0b0 + P-1b-1 + P-2b-2 + P-3b Increase by 1 Decrease by 1 Dr. Wang Background Review Lecture
11
Xing - Fall09 Exercise (1) Specify the value of the digit 5 in the following decimal numbers: 25 51 4538 The positional value is a power of the base and the powers begin at 0 and increase by 1 as we move left in the number. Dr. Wang Background Review Lecture
12
Binary Octal Hexadecimal Decimal Base 2 2 symbols:0,1 Base 8
Xing - Fall09 Decimal (base 10) Binary (base 2) 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 1010 1011 12 1100 13 1101 14 1110 15 1111 16 10000 17 10001 Octal (base 8) Hexadecimal (base 16) 1 2 3 4 5 6 7 10 8 11 9 12 A 13 B 14 C 15 D 16 E 17 F 20 21 Binary Base 2 2 symbols:0,1 Octal Base 8 8 symbols: 0,1,2,3,4,5,6,7 ,3,4,5,6,7,8,9 Hexadecimal Base 16 16 symbols: 0,1,2,3,4,5,6,7,8,9, A,B,C,D,E,F More compact representation of the binary system Decimal Base 10 10 symbols: 0,1,2,3,4,5,6,7,8,9 Dr. Wang Background Review Lecture
13
Example of Equivalent Numbers
Xing - Fall09 Example of Equivalent Numbers Binary: Octal: Decimal: Hexadecimal: 50A716 Notice how the number of digits gets smaller as the base increases. Dr. Wang Background Review Lecture
14
Agenda Overview of number systems Number systems conversions
Xing - Fall09 Agenda Overview of number systems Positional and non-positional Base, positional value, symbol value Binary, decimal, octal, hexadecimal Number systems conversions Dr. Wang Background Review Lecture
15
Number Systems Conversions
Xing - Fall09 Number Systems Conversions Binary, Octal, and Hex to Decimal Decimal to Hex, Octal, and Binary Binary Hex Binary Octal Hex Octal Dr. Wang Background Review Lecture
16
1. Binary, Octal, Hex Decimal
Xing - Fall09 1. Binary, Octal, Hex Decimal Multiply the decimal equivalent of each digit by its positional/place value (a power of the base) and sum these products In general (base is b: 2 for binary, 8 for Octal, 16 for Hex), N = ...P3P2P1P0 . P-1P-2P-3... = P3b3 + P2b2 + P1b1 + P0b0 + P-1b-1 + P-2b-2 + P-3b Dr. Wang Background Review Lecture
17
Xing - Fall09 Exercise (2) Convert the following numbers to their decimal equivalents 1AB.616 Dr. Wang Background Review Lecture
18
2. Decimal Binary, Octal, or Hex
Xing - Fall09 2. Decimal Binary, Octal, or Hex To convert decimal numbers to any base we divide with the corresponding base until the quotient is zero and write the remainders in reverse order. Dr. Wang Background Review Lecture
19
Decimal Octal, Binary, Hex
Xing - Fall09 Decimal Octal, Binary, Hex Divide the decimal number successively by 8 (for Octal), 2 (for Binary), 16 (for Hex) After each division record the remainder Octal: 0,1,…, or, 7 Binary: either a 1 or 0 Hex: 1, 2,…, or,9, or A, B, …, or F Continue until the result of the division (quotient) is 0 Write the remainders in reverse order Quoetint vs remainder. Dr. Wang Background Review Lecture
20
Exercise (3) Convert 123|10 to Base 8 Convert 59|10 to Base 2
Xing - Fall09 Exercise (3) Convert 123|10 to Base 8 Convert 59|10 to Base 2 Convert 42|10 to Base 16 Dr. Wang Background Review Lecture
21
Number Systems Conversions (Agenda)
Xing - Fall09 Number Systems Conversions (Agenda) Binary, Octal, and Hex to Decimal Decimal to Hex, Octal, and Binary Binary Hex Binary Octal Hex Octal Dr. Wang Background Review Lecture
22
Xing - Fall09 Binary Hex Dr. Wang Background Review Lecture
23
Binary to Hexadecimal Conversion
Xing - Fall09 Binary to Hexadecimal Conversion Decimal Binary Hexadecimal 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F |2 = ?|16 Work from right to left Divide into 4-bit groups ## B NOTE: # is a place holder for zero! Dr. Wang Background Review Lecture
24
Hexadecimal to Binary Conversion
Xing - Fall09 Hexadecimal to Binary Conversion Decimal Binary Hexadecimal 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F FACE|16 = ?|2 F A C E FACE|16= |2 Dr. Wang Background Review Lecture
25
Xing - Fall09 Binary Octal Dr. Wang Background Review Lecture
26
Binary to Octal Conversion
Xing - Fall09 Binary to Octal Conversion |2=?|8 # |2=25615|8 Binary Octal 000 001 1 010 2 011 3 100 4 101 5 110 6 111 7 Work from right to left Divide into 3 bit groups Dr. Wang Background Review Lecture
27
Octal to Binary Conversion
Xing - Fall09 Octal to Binary Conversion Binary Octal 000 001 1 010 2 011 3 100 4 101 5 110 6 111 7 1247|8=?|2 1247|8= |2 = |2 Note: one need not write the leading zeros Dr. Wang Background Review Lecture
28
Xing - Fall09 Hexadecimal Octal Dr. Wang Background Review Lecture
29
How do we convert from hexadecimal to octal and vice versa?
Xing - Fall09 How do we convert from hexadecimal to octal and vice versa? Convert to binary first! Dr. Wang Background Review Lecture
30
Xing - Fall09 Exercise (4) Do you know the equivalent hexadecimal, octal, and decimal values of the binary number ? ______Yes _______No If you answered Yes, please indicate them below: Equivalent hexadecimal number:________________ Equivalent octal number: __________________ Equivalent decimal number: __________________ What is the equivalent binary number of the decimal number 63? _____________________________ From Background Survey Dr. Wang Background Review Lecture
31
Exercise (5) Convert 18110 to binary and hex Convert 121F16 to decimal
Xing - Fall09 Exercise (5) Convert to binary and hex Convert 121F16 to decimal Convert to hex Convert A17F16 to octal Dr. Wang Background Review Lecture
32
Xing - Fall09 Summary Basic number systems concepts (base, positional/place value, symbol value) Convert back and forth between decimal numbers and their binary, octal, and hexadecimal equivalents Abbreviate binary numbers as octal or hexadecimal numbers Convert octal and hexadecimal numbers to binary numbers Dr. Wang Background Review Lecture
33
Xing - Fall09 Solution (1) Specify the value of the digit 5 in the following decimal numbers: the 5 in 25 = 5 x 100 = 5 the 5 in 51 = 5 x 101 = 50 the 5 in 4538 = 5 x 102 = 500 The positional value is a power of the base and the powers begin at 0 and increase by 1 as we move left in the number. Dr. Wang Background Review Lecture
34
Xing - Fall09 Solution (2) = 1 x x x x x x 21+1 x 20 = = 7710 = 1 x x x x x x 2-2 = /2 + 1/4 = 1AB.616 = 1 x A x B x x 16-1 = 1 x x x x 16 = = = 1 x x x x x 8-2 = 1 x x x 1 + 2/8 + 5/64 = = Dr. Wang Background Review Lecture
35
Base you are converting to
Xing - Fall09 Solution (3-1) Convert 123|10 to Base 8: 8 )123 8 )15 R 3 8 )1 R 7 0 R 1 Therefore, 123|10 = 173|8 Base you are converting to Read Up! Dr. Wang Background Review Lecture
36
Solution (3-2) Convert 59|10 to Base 2: 59|10 =1110112
Xing - Fall09 Solution (3-2) Convert 59|10 to Base 2: 59|10 = Convert 42|10 to Base 16: 16 )42 16 )2 R A 0 R 2 Read Up! Therefore, 42|10 = 2A|16 Dr. Wang Background Review Lecture
37
Xing - Fall09 Solution (4) Do you know the equivalent hexadecimal, octal, and decimal values of the binary number ? ______Yes _______No If you answered Yes, please indicate them below: Equivalent hexadecimal number:__CA___________ Equivalent octal number: _______312___________ Equivalent decimal number: _____202_____________ What is the equivalent binary number of the decimal number 63? ________111111_____________ From Background Survey Dr. Wang Background Review Lecture
38
Solution (5) Convert 18110 to binary (10110101) and hex (B5)
Xing - Fall09 Solution (5) Convert to binary ( ) and hex (B5) Convert 121F16 to decimal ( ) Convert to hex (2AC16) Convert A17F16 to octal ( ) Dr. Wang Background Review Lecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.