chapter 1
play

Chapter 1 Analog vs. Digital Positional Number Systems Number - PDF document

Chapter Outline Chapter 1 Analog vs. Digital Positional Number Systems Number Systems And Codes Positional Number System Conversions Binary System operations Computer Application Encoding Techniques Flaxer Eli - ComputerAppl


  1. Chapter Outline Chapter 1 � Analog vs. Digital � Positional Number Systems Number Systems And Codes � Positional Number System Conversions � Binary System operations Computer Application � Encoding Techniques Flaxer Eli - ComputerAppl Ch 1 - 1 Flaxer Eli - ComputerAppl Ch 1 - 2 Digital vs. Analog Digital vs. Analog � Natural world is analog � Digital characteristics v � Many devices better when digital: – Discrete signal levels (voltage usually) – Two levels: on/off, high/low 1/0 (binary) – Disjoint or quantized level changes t Digital Analog Compact Disc Magnetic Tape v Microcomputer-controlled Engine Mechanically-controlled Engine � Analog characteristics Telephone System Telephone System – Continuous signal levels Movie Special Effects Movie Special Effects – Very small, smooth level changes t Digital Computers: Analog Computer: PC, Mainframe, Supercomputer OpAmp, Res, Cap Flaxer Eli - ComputerAppl Flaxer Eli - ComputerAppl Ch 1 - 3 Ch 1 - 4 Positional Number System Digital vs. Analog � General form of a number : � Advantages of each technology: d d ...d d .d d ...d − − − − − p 1 p 2 1 0 1 2 n � The value of the number : Digital Analog − p 1 ∑ Reproducible results Less complex ? = ⋅ i D d r i Ease of design = − i n Higher speed ? Flexible and function Programmable � . : radix point High speed � r : base or radix Economical � dp-1 : the most significant digit � d-n : the least significant digit Flaxer Eli - ComputerAppl Ch 1 - 5 Flaxer Eli - ComputerAppl Ch 1 - 6 1

  2. Binary System Decimal System The form of a binary number is: � d : 0 , 1 , 2 , . . . , 9 b b ... b b b . b ... b − − − − − p 1 p 2 1 0 1 2 n � r = 10 � Example : 2081.35 The decimal value of the number is: p = 4 , n = 2 − p 1 ∑ = ⋅ i B b r i = = = = = = d 2 , d 0 , d 8 , d 1 , d 3 , d 5 − − 3 2 1 0 1 2 = − i n 3 ∑ = ⋅ i � r = 2 ( binary radix ) 2 0 8 1 3 5 . d i 1 0 = − i 2 � . : binary point = ⋅ + ⋅ + ⋅ + ⋅ + ⋅ − + ⋅ − 3 2 1 0 1 2 208135 . 2 10 0 10 8 10 1 10 3 10 5 10 � bi ( binary digit = bit ) : 0 , 1 � bp-1 : the most significant bit ( MSB ) = ⋅ + ⋅ + ⋅ + ⋅ + ⋅ + ⋅ 208135 . 2 1000 0 100 8 10 1 1 3 01 . 5 0 01 . � b-n : the least significant bit ( LSB ) Flaxer Eli - ComputerAppl Ch 1 - 7 Flaxer Eli - ComputerAppl Ch 1 - 8 Exercise Example : � 11101.01 � Calculate the equivalent decimal numbers : 1 , 10 , 11 , 100 , 101, 10101.11 � p = 5 , n = 2 � Answer : 1 (2) = 1 (10) = = = = = = = b 1 , b 1 , b 1 , b 0 , b 1 , b 0 , b 1 − − 4 3 2 1 0 1 2 10 (2) = 2 (10) 4 ∑ 11 (2) = 3 (10) = ⋅ i B b i 2 100 (2) = 4 (10) = − i 2 101 (2) = 5 (10) − − B = ⋅ + ⋅ + ⋅ + ⋅ + ⋅ + ⋅ + ⋅ 4 3 2 1 0 1 2 1 2 1 2 1 2 0 2 1 2 0 2 1 2 10101.11 (2) = 21.75 (10) B = + + + + + + = 16 8 4 0 1 0 025 . 29 25 . Flaxer Eli - ComputerAppl Flaxer Eli - ComputerAppl Ch 1 - 9 Ch 1 - 10 Octal and Hexadecimal Numbers Binary, Decimal, Octal and Hexadecimal Numbers Decimal Binary Octal Hexadecimal � Octal number System : 0 0 0 0 - r = 8 1 1 1 1 - d : 0 , 1 , 2 , . . . , 7 2 10 2 2 3 11 3 3 � Hexadecimal number System : 4 100 4 4 - r = 16 5 101 5 5 6 110 6 6 - d : 0 , 1 , 2 , . . . , 9, A, B, C, D, E, F 7 111 7 7 � The radices are powers of 2 8 1000 10 8 9 1001 11 9 � Used for shorthand representations of long 10 1010 12 A binary numbers 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F Flaxer Eli - ComputerAppl Ch 1 - 11 2

  3. Binary - Octal/Hexadecimal Conversion Binary - Octal/Hexadecimal Conversion � Binary to Octal/Hexadecimal : � Octal/Hexadecimal to Binary: Starting from the decimal point : Convert each Octal/Hexadecimal digit into its corresponding - Separate the bits into groups of three/four 3 / 4 bit string - Replace each group with its corresponding Octal/Hexadecimal � Examples : digit - 621.3(8) = 110010001.011(2) � Examples : - F5A.2C(16) = 111101011010.00101100(2) - 100011110.10101 (2) = 100 011 110.101 010 = 436.52 (8) - 1011101000.001111 (2) = 0010 1110 1000.0011 1100 = 2E8.3C (16) Flaxer Eli - ComputerAppl Ch 1 - 13 Flaxer Eli - ComputerAppl Ch 1 - 14 Exercise General Positional Number Conversion � Convert 101100.101 into hexadecimal, octal and � radix-r to decimal : decimal. − p 1 ∑ = ⋅ i � Convert F4A into binary D d r i = − i n � Answers : - 101100.101 (2) = 2C.A (16) = 44.625 (10) � decimal to radix-r : - 101100.101 (2) = 54.5 (8) - Successive division of D by r - F4A (16 ) =111101001010 (2) - The remainder of the long divsion will give the digits starting from the least significant digit Flaxer Eli - ComputerAppl Flaxer Eli - ComputerAppl Ch 1 - 15 Ch 1 - 16 Example - Decimal to Binary : Exercise � 179 (10) � Convert 154 into binary. 179/2 = 89 ( 1 ) LSB � Answer : 10011010 89/2 = 44 ( 1 ) 44/2=22 ( 0 ) 22/2=11 ( 0 ) 11/2=5 ( 1 ) 5/2=2 ( 1 ) 2/2=1 ( 0 ) 1/2=0 (1)MSB � Result : 10110011 (2) Flaxer Eli - ComputerAppl Ch 1 - 17 Flaxer Eli - ComputerAppl Ch 1 - 18 3

  4. Example - Decimal to Binary (Fraction): Binary Addition � .375 (10) Binary addition table : .375 * 2 = 0.75 ( 0 ) .75 * 2 = 1.5 ( 1 ) carry(in) x y x+y carry(out) .5 * 2 = 1.0 ( 1 ) 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 Fin � Result : .011 (2) 1 0 1 0 1 1 1 0 0 1 Example : 1 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 x 1 7 3 1 0 1 0 1 1 0 1 y + 4 4 0 0 1 0 1 1 0 0 _____ ____________ 2 1 7 1 1 0 1 1 0 0 1 Flaxer Eli - ComputerAppl Ch 1 - 19 Flaxer Eli - ComputerAppl Ch 1 - 20 Representation of Natural Numbers in Exercise Binary Systems (Unsigned Number) � There has 2 n parmutation in order n bits � 1 1 0 1 0 0 1 0 1 0 1 + 0 1 1 1 1 + 0 1 1 0 0 1 � The range for n-bit is : _________ __________ � 1 0 1 0 0 1 1 0 1 1 1 0 from 0 to + (2 n - 1) 26+15 = 41 21+25=46 Flaxer Eli - ComputerAppl Flaxer Eli - ComputerAppl Ch 1 - 21 Ch 1 - 22 Exercise Binary Subtraction � Binary Subtraction table : � 1 1 0 1 0 1 1 1 0 1 - 0 1 1 1 1 - 1 0 1 1 1 borrow(in) x y x-y borrow(out) ________ _________ 0 0 0 0 0 0 0 1 1 1 � 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 26 - 15 = 11 29 - 23 = 6 0 1 1 0 0 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 Example : 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 x 2 1 0 1 1 0 1 0 0 1 0 y - 1 0 9 0 1 1 0 1 1 0 1 _____ ____________ 1 0 1 0 1 1 0 0 1 0 1 Flaxer Eli - ComputerAppl Ch 1 - 23 Flaxer Eli - ComputerAppl Ch 1 - 24 4

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