Download presentation
Presentation is loading. Please wait.
1
Binary Representation in Text
2
Why is it important to know how to convert between Hex, Dec, Binary?
Binary and hexadecimal are useful because it turned out that it was more practical to construct complex machinery that uses digital electronics rather than analog electronics. Octal numbering is also used, but it is not as useful for our purpose as Binary, Hexadecimal and Decimal systems. In the context of electronics, it means a current or voltage is used to turn on, or turn off a “switch.” Thus it is practical for the on/off values to be just two -- on or off. Thus the easiest way for our electronics to work in terms of “bits”, or binary digits.
3
Why is it important to know how to convert between Hex, Dec, Binary?
The other numbering systems (hexadecimal and octal) became useful as a result. Binary numbers are a pain for humans to deal with because they get large, in terms of number of digits quickly. Example, …and humans don’t like numbers with lots of digits.
4
Why is it important to know how to convert between Hex, Dec, Binary?
To make things easier for ourselves, it makes sense to group raw binary code and treat these groups as a single digit. Each digit in the hexadecimal system is equivalent to a four-digit binary numbers. Example: f (in hexadecimal) = 1111 (binary code)
5
ASCII ASCII is an acronym for the American Standard Code for Information Interchange. It is a standard seven-bit code that was first proposed by the American National Standards Institute or ANSI in 1963, and finalized in 1968 as ANSI Standard X3.4. The purpose of ASCII was to provide a standard to code various symbols both visible (letters, numbers, punctuation) and invisible symbols (space bar, enter tab, shift, control etc…).
6
ASCII In the ASCII character set, each binary value between 0 and 127 represents a specific character. Most computers extend the ASCII character set to use the full range of 256 characters available in a byte. The upper 128 characters handle special things like accented characters from common foreign languages.
7
ASCII In general, ASCII works by assigning standard numeric values (decimal) to letters, numbers, punctuation marks and other characters such as control codes. An uppercase "A," for example, is represented by the decimal number 65."
8
Bytes and ASCII By looking at the ASCII table, you can clearly see a one- to-one correspondence between each character and the ASCII code used. For example, 32 is the ASCII code for a space. We could expand these decimal numbers out to binary numbers where 32 = , if we wanted to be technically correct -- that is how the computer really deals with things.
9
Bytes and ASCII Computers store text documents, both on disk and in memory, using these ASCII codes. For example, if you use Microsoft Word in Windows XP/2000 to create a text file containing the words, “Friends, Romans, Countrymen” Word would use 1 byte (8 bits) of memory per character (including 1 byte for each space character between the words) In this example, the total would be characters. When Word stores the sentence in a file on disk, the file will also contain 1 byte per character and per space.
10
Bytes and ASCII If you were to look at the file as a computer looks at it, you would find that each byte contains not a letter but a number -- the number is the ASCII code (decimal) corresponding to the character. So on disk, the numbers for the file look like this: Text - Friends, Roman, Countrymen Decimal Format Binary Format
11
Bytes and ASCII Externally, it appears that human beings will use natural languages symbols to communicate with computer – English, French, Arabic, Spanish and etc… But a computer will convert the decimal, or hexadecimal, code into binary data and then process all information in binary world. Finally, computer will convert binary information back to decimal, or hexadecimal, code which is then converted into symbols and characters understandable to human beings.
12
Bytes and ASCII When you type the letter A, the hardware logic built into the keyboard automatically translates that character into the ASCII code 65 (decimal value). This is then sent to the computer and read in binary ( ). Similarly, the computer takes the binary code and sends the ASCII code 65 (decimal value) to output devices, the output hardware interprets the code and draws the letter “A” on your screen of your computer. As such, this is how binary code is used to create text on a computer. Input - A 65 Output 65 A
13
Layered View of Representation
Input sequence below Output sequence below Text string Information Data A great diagram to copy. Sequence of characters Information Data Character Bit string
14
Unicode - representation
ASCII code can represent 8 bits information only 128 = 27 characters. It only represents the English Alphabet plus some control characters. Unicode is designed to represent the worldwide interchange by recognizing more than one language. It uses 16 bits and can represents 32,768 = 215 characters.
15
ASCII Assignment Using ASCII you are to write the following messages:
Your name – convert it to decimal than to binary. Have your partner convert it back to text. Write a sentence for a friend, put it into decimal and then have your partner decode it in class.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.