Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 163-1Recall ...Numbers in Binary•Remember:–Analog/Digital/Binary–Binary to Decimal–Decimal to Binary–Binary Addition/Subtraction•In this lecture:–further binary representations of data:•Numbers•Symbols•Images•Sound3-2Binary Numbers•Binary numbers actually have some other neat properties as well . . .–QUESTION: Can you multiply a binary number by two (decimal) and give the result in binary quickly?•Multiply the number 00110 by two (and give the answer in binary)–Why does this work?22222012341248160 1 1 00253203-3Symbols and Text•We now know how to represent decimal numbers in binary.•Next we need to be able to represent characters/symbols in binary.•How do you think we should represent characters in binary?–We know how to represent decimal numbers in binary so…•Let’s associate each symbol with a (binary) number–Our system will be if we see number 1, we know it’s A, 2 is B, …1 = A 2 = B 3 = C 4 = D and so on…1. What characters (symbols) should we map?2. How many bits do we need to represent each character?3. How does someone looking at a sequence of 1’s and 0’s know what to interpret as a number, what is a symbol, where one number ends and the next number starts?3-4Symbols and Text1. Well, we need to map any character that we might want to print, uppercase, lowercase, punctuation, numbers, symbols, and more.–Whereas this is relatively small number for the English language, imagine if we need to represent many languages. . .2. The number of bits per symbol is determined by the number of symbols we decide we need. Lets say we determine that we have 255 symbols, how many bits is that?3. Do we need the same number of bits per symbol?–Hint: memory is a contiguous block of 0’s and 1’s, there are no natural “breaks” in memory–Hint2: imagine A = “0” B = “1” C = “10” D = “11”•convert the binary message back into symbols: 0110–Actually, we don’t need to use the same number of bits per symbol provided that we can map symbols such that there is always exactly one correct mapping of bit strings to symbols – we would need to be clever!–We will deal with “compression” issues later in the semester3-5Symbols and Text4. How do others know how to convert our mess of bits into the proper symbols?–We establish a standard, and let others know what standard we’re using many standards exists . . . •IBM’s EBDIC (Extended Binary Decimal Interchange Code)–Used by mainframes and other specific IBM computers•The ANSI group’s ASCII code.–ANSI = American National Standards Institute–ASCII = American Standard Code for Information Interchange–ASCII was the predominant standard in the US. –Includes uppercase, lowercase, numbers, symbols and “control characters” – basic actions the cursor should take in dealing with text•Non-printed – think typewriter carriage movement•UNICODE started by International Organization for Standardization (ISO) and the “Unicode Project” – now governed by the Unicode Consortium–UNICODE represents most languages–Symbolic symbols in addition to textual3-6Symbols and Text0 - 001100001 - 001100012 - 001100103 - 001100114 - 001101005 - 001101016 - 001101107 - 001101118 - 001110009 - 00111001: - 00111010A - 01000001B - 01000010C - 01000011D - 01000100E - 01000101F - 01000110G - 01000111H - 01001000I - 01001001J - 01001010K - 01001011a - 01100001b - 01100010c - 01100011d - 01100100e - 01100101f - 01100110g - 01100111h - 01101000i - 01101001j - 01101010k - 01101011Ctrl+@ - 00000000Ctrl+A - 00000001Ctrl+B - 00000010Ctrl+C - 00000011Ctrl+D - 00000100Ctrl+E - 00000101Ctrl+F - 00000110Ctrl+G(Bell) - 00000111Space - 00100000Delete - 01111111A partial listing of the ASCII character set3-7Representation of Images•To actually draw the correct image for a symbol in our symbol mapping standard, we actually need to be able to store what that symbol looks like . . .–To better define the problem, we have a region that we’d like to fill with a picture of a character. •we’d like to describe an E in black in this 6x6 grid0100000100010000101000110100101001100100000 for black1 for white3-8Representation of Images•Each square in the grid is called a pixel short for “pixel element”–We call this sort of image a bitmap – literally, a map of bits.–In the previous example each pixel would be either black or white.–We can also use this scheme for pictures…0101010101010101010101101011010010010001111100000110101010101010101010010110100101100101000001101001010101010101010101101100010100001010010101001011011010110110101101011001100101101000100010010110100101101001011010100010011001001011010100101001011011001010110101011101100110010100101011000110100100110101100100100010011001101010100100010101011011001011001001011101100110010101001001010101010101010100110110100010011000101000010101001010101010101011000100101100100011010011101000010101010101010100010001010001011010000100000011011101101010100101001101000110100100111001011010001010010101001000101001011001011011000010100000101010110100010010010010010111101010110101001011001010100001000100100101111101011111001010010010010101001010010001001010101011101010110100100100001010010000100110011011111010111010101010001001010100100101001000110110000111101110110101101010000001000000010011001001111111111101101110000000101010001010100100110110000101010111010000101010000000100001001011010100111111111111110111010001010010001010011010101001000111011111101000100100000100100101100010010010011110111101011011001001011001001000001110100100100101111111110110010010003-9Representation of Images•a picture with many (small) pixels – the result is more detail•By using more pixels we say we increase the resolution of the image–The image looks better, but at the cost of storing more data.–we usually describe resolution in by describing the size of our pixel grid (length x width) •“This bitmap has a resolution of 1920x1200”–literally 2,304,000 pixels.–If we’re storing only black and white, how many bits is this bitmap?•With digital cameras people talk about resolution in megapixels–If my camera is 2.3 megapixels …•This means that the highest quality image I can take is will have 2.3 million pixels in it(the resolution is probably 1920x1200)3-10Representation of Images•a picture with four


View Full Document

BU CS 101 - Numbers in Binary

Download Numbers in Binary
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Numbers in Binary and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Numbers in Binary 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?