Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.

Similar presentations


Presentation on theme: "1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6."— Presentation transcript:

1 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6

2 2 Announcements Homework 3 –Due on Friday, 09/10/04

3 3 Review Digital information –Advantages Number system –Non-positional –Positional Decimal Octal Binary

4 4 Outline Binary numbers

5 5 Binary Number System Since binary digits have two possible values they are called bits –They only contain a little “bit” of information –Numbers represented in binary form will (most likely) require more digits (bits) than the decimal form

6 6 Binary Number System Number of Bits Number of Values 12 24 38 416 532 664 7128 8256 To represent more information –Lump together multiple bits called strings

7 7 Binary Number System In general number of values = 2 number of bits How does 1 bit represent 2 values? –It can have one of two values 0, 1 –Can represent two colors, black and white –0: black –1: white Can represent two numbers: 0, 1

8 8 Binary Number System How do 2 bits represent 4 values? Bit PatternNumeric Value Item Represented 000Black 011White 102Red 113Green

9 9 Binary Number System How do 3 bits represent 8 values? Bit PatternNumeric ValueItem Represented 0000Black 0011White 0102Red 0113Green 1004Blue 1015Purple 1106Magenta 1117Sky blue

10 10 Binary Number System How do 4 bits represent 16 values? Bit PatternValueBit PatternValue 0000010008 0001110019 00102101010 00113101111 01004110012 01015110113 01106111014 01117111115

11 11 Binary Number System Bit patterns and numeric values are consistent with other slides –Acceptable to add leading 0’s if desired

12 12 Binary Number System We can represent the non-negative numbers (unsigned number) How about representing negative numbers? –Let the left most bit represent the sign (+, -) of the number –Called signed magnitude representation –[s][mag] 0 – 2 number of bits - 1

13 13 Signed Magnitude –One less bit to represent the magnitude

14 14 Signed Magnitude Problems –Two values of 0 More difficult to detect than one value of 0 –Incorrect arithmetic 2 – 1 = 2 + (-1) = 1

15 15 Two’s Complement Representation Sign bit in a sense –Positive numbers The leading bit (left most) is zero The same as signed magnitude –Negative numbers The leading bit is one Defined so that when added to their corresponding positive number the answer is zero

16 16 Bit PatternValueBit PatternValue 000001000-8 000111001-7 001021010-6 001131011-5 010041100-4 010151101-3 011061110-2 011171111 Two’s Complement Representation

17 17 Two’s Complement Representation Problems with signed magnitude representation are solved with the two’s complement representation –There is only value of zero –Arithmetic is correct Solution is in two’s complement form 2 – 1 = 2 + (-1) = 1

18 18 Binary Encoding Unsigned binary numbers are useful when labeling things Common grouping –4 bits: nibble –8 bits: byte One byte represents 256 different values or items

19 19 Binary Number System –Letters in the English language A = 65 10 = 0100 0001 2 B = 66 10 = 0100 0010 2 … Z = 90 10 = 0101 1010 2 … a = 97 10 = 0110 0001 2 … Z = 122 10 = 0111 1010 2 Numbers are still left over for punctuation

20 20 Binary Number System Precision –The number of bits used to represent an item Letter: precision of 8 bits Integer (whole number): precision of 32 or 64 bits –Always finite Computers have finite precision –Presents some limitations

21 21 Hexadecimal Number System Sometimes called hex –Positional,base-16 system –Each digit is multiplied by a power of 16 –Sixteen unique symbols (digits) 0, 1, 2, …, 15 Symbol a or A for 10 Symbol b or B for 11 Symbol e or E for 14 Symbol c or C for 12 Symbol f or F for 15 Symbol d or D for 13

22 22 Hexadecimal Number System A hex number can represent 16 different items –Equivalent to 4 bits –Makes it easy to convert between binary and hex Group bits by 4’s from the left end Substitute the hex symbol –90 10 = 0101 1010 2 = 5A 16 »Is the base 16 really needed? –66 10 = 0100 0010 2 = 42 16

23 23 Hexadecimal Number System Use the backwards conversion to convert hex to binary –One hex digit is equivalent to 4 bits –Substitute the binary nibble Always start at the right end Add zeros to the left end as necessary to fill in 4 bits

24 24 Hexadecimal Number System HEXDECBIN 000000 110001 220010 330011 440100 550101 660110 770111 881000 991001 A101010 B111011 C121100 D131101 E141110 F151111

25 25 Digitization The process of converting analog information into binary –Discrete forms are unambiguous Text and numbers are discrete –Conversion of discrete to digital Come up with a mapping –As we did with the letters

26 26 Binary Coded Decimal Integers (whole numbers) –One mapping is to use its binary equivalent Binary Coded Decimal (BCD) –0 10 = 0000 2 –1 10 = 0001 2 – … –9 10 = 1001 2 Need a minimum of 4 bits to represent 10 different values –Some 4 bit quantities are wasted

27 27 Binary Coded Decimal String of decimal digits –Each decimal digit is represented by 4 bits –The number of bits needed to represent different numbers vary –Performing arithmetic is complicated

28 28 Digitizing Analog Information Two steps –Sampling the information Select discrete samples that represents the information –Quantizing the samples Discrete samples are measured Encoded into a binary representation

29 29 Digitizing Analog Information Sampling –In time or space (picture) Quantizing –Approximating the measured value

30 30 Images are digitized using a two step process Sampling the continuous tone image Quantizing the samples Digitizing Images

31 31 Sample image by pixel resolution Spatial Sampling Sample two- dimensional space Sampling Images

32 32 All gray values in each sample are averaged Quantizing Images

33 33 Different amount of sampling Quantizing Images

34 34 Different amount of sampling Quantizing Images

35 35 Different amount of sampling Quantizing Images


Download ppt "1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6."

Similar presentations


Ads by Google