previous lecture today s lecture slides for lecture 2
play

Previous Lecture Todays Lecture Slides for Lecture 2 ENEL 353: - PowerPoint PPT Presentation

ENEL 353 F13 Section 02 Slides for Lecture 2 slide 2/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 3/21 Previous Lecture Todays Lecture Slides for Lecture 2 ENEL 353: Digital Circuits Fall 2013 Term Number systems: decimal,


  1. ENEL 353 F13 Section 02 Slides for Lecture 2 slide 2/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 3/21 Previous Lecture Today’s Lecture Slides for Lecture 2 ENEL 353: Digital Circuits — Fall 2013 Term Number systems: decimal, binary, octal, and hexadecimal. Steve Norman, PhD, PEng Related material in Harris & Harris (our course textbook): ◮ Introduction to ENEL 353 ◮ Sections 1.1, 1.2, 1.3: general background on digital ◮ Course policies Electrical & Computer Engineering Schulich School of Engineering design University of Calgary ◮ Sections 1.4.1, 1.4.2, 1.4.3: closely related to today’s lecture 11 September, 2013 slide 4/21 slide 5/21 slide 6/21 ENEL 353 F13 Section 02 Slides for Lecture 2 ENEL 353 F13 Section 02 Slides for Lecture 2 ENEL 353 F13 Section 02 Slides for Lecture 2 Number systems The decimal system The decimal system 702.53 stands for ... What is the general pattern used for a number in the decimal What does 702.53 mean? 7 × 10 2 system? Seven hundred and two point five three, of course! Why even + 0 × 10 1 Ten is called the base or the radix of the decimal system. ask the question? + 2 × 10 0 It’s probably not a coincidence that most of us have ten We’ve all used numbers in this form so often that it’s possible + 5 × 10 − 1 fingers and that ten is the radix of the number system we use we’ve forgotten the underlying rules for the number system + 3 × 10 − 2 in daily life! we use every day. The plural of radix is radices . This an example of the decimal system , by far the most common system used by humans for representing numbers. ENEL 353 F13 Section 02 Slides for Lecture 2 slide 7/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 8/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 9/21 About the word “decimal” Other radices? General format for a base r number Write it as two lists of digits separated by a dot: For any integer r ≥ 2, you can create a number system with In technical discussion of number systems, decimal means radix r . Such a system would be called a “base r ” number d n d n − 1 d n − 2 · · · d 1 d 0 . d − 1 d − 2 · · · d − p “base ten, with numbers written using digits 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9.” system. Each digit d k must be ≥ 0 and < r . You would need symbols for digits ranging from 0 up to r − 1. The word decimal does NOT mean “has a dot to separate the Mathematically, the number is . . . integer part of a number from the fraction part.” If r ≥ ten, you can just use the digits we already have. n So 28 + 79 = 107 is an example of decimal addition, even If r > ten, you have to make up new symbols for ten, eleven, � d k r k though you don’t see any “decimal points”. twelve, etc. k = − p

  2. ENEL 353 F13 Section 02 Slides for Lecture 2 slide 10/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 11/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 12/21 Textbook notation for indicating a radix Base two numbers, also called binary numbers Conversion from base r to base ten Numbers in the course textbook, course notes, quizzes, tests, Base two is important because it allows design of fast and etc., will often have a base ten subscript to make it clear what Just use the formula: efficient electronic circuits for arithmetic: addition, n radix is in use. � d k r k subtraction, multiplication, etc. So 17 10 is just the number we all know as seventeen. Usually k = − p A binary digit is called a bit . So a bit is a thing that can have it would be written as 17, with no subscript. We’ve already used it for 1011 . 01 2 . one of two values: 0 or 1. What are 17 8 and 17 16 in base ten? Another example: What is 235 16 in base ten? Binary number example: What is 1011 . 01 2 in base ten? How about 18 8 and 19 8 ? slide 13/21 slide 14/21 slide 15/21 ENEL 353 F13 Section 02 Slides for Lecture 2 ENEL 353 F13 Section 02 Slides for Lecture 2 ENEL 353 F13 Section 02 Slides for Lecture 2 Conversion from base ten to base r : integers only Conversion from base ten to base r: numbers with Conversion from base ten to base r : more about fractions numbers with fractions This algorithm is important to know in ENEL 353; make sure you get lots of practice with it. The algorithm is not guaranteed to terminate in a finite The algorithm is: Using base ten, repeatedly divide by r until number of steps! For example, try to convert 0 . 6 10 to We won’t need this algorithm in ENEL 353, but it’s nice to you get a quotient of zero. The remainders you get along binary . . . know that it exists. the way are the digits of the base r number. The algorithm is: Using base ten, repeatedly multiply by r . multiplication product integer part remark Example: Convert 13 10 to binary. The integer parts of the numbers you get along the way are 0 . 6 × 2 1.2 1 0 . 1 2 so far Example: Convert 87 10 to base eight. the digits of the base r number. Fractional parts are used in 0 . 2 × 2 0.4 0 0 . 10 2 so far subsequent multiplications. 0 . 4 × 2 0.8 0 0 . 100 2 so far (Note that this method matches the paragraph that starts, 0 . 8 × 2 1.6 1 0 . 1001 2 so far Example: Convert 0 . 6875 10 to binary. “Working from the right . . . ,” in Example 1.5 on page 13 of 0 . 6 × 2 1.2 1 Uh-oh . . . a cycle! Harris & Harris.) ENEL 353 F13 Section 02 Slides for Lecture 2 slide 16/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 17/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 18/21 Conversion from base ten to base r : more about Octal and hexadecimal systems Conversion between binary, octal, and hex numbers with fractions The radix 8 system is called octal and so uses digits 0, 1, 2, 3, Conversion is easy! 3 bits make one octal digit; 4 bits make 4, 5, 6 and 7. one hex digit. The algorithm tells us that The radix 16 system is called hexadecimal or “hex” and uses Example: Express 11010 2 in octal and hex. 0 . 6 10 = 0 . 1001 1001 1001 1001 · · · 2 . digits 0, 1, 2, . . . , 8, 9, and, um, wait a minute, what comes The problem is NOT that the algorithm is somehow defective. More examples: Express 153 8 and 5 D 16 in binary. after 9? So what is the real problem here? One more example: Convert 487 10 to hex and octal. Example: What is 3 A 9 . C 16 ?

  3. ENEL 353 F13 Section 02 Slides for Lecture 2 slide 19/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 20/21 ENEL 353 F13 Section 02 Slides for Lecture 2 slide 21/21 Learn these tables! Hex gets used a lot! Next Lecture octal bit hex bit hex bit It’s a convenient way for humans to describe binary data. digit pattern digit pattern digit pattern Example: HTML color encoding uses two hex digits for 0 000 0 0000 8 1000 ◮ Addition of binary unsigned integers. brightness of each of red, green, and blue. #FFA500 (FF 16 1 001 1 0001 9 1001 means maximum red, A5 16 means quite a lot of green, and ◮ Representation of signed integers. 2 010 2 0010 A 1010 00 16 means no blue at all) is a shade of orange . . . 3 011 3 0011 B 1011 ◮ Related reading in Harris & Harris: Sections 1.4.4 to 4 100 4 0100 C 1100 1.4.6. 5 101 5 0101 D 1101 + + = 6 110 6 0110 E 1110 7 111 7 0111 F 1111

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend