Representing Information in Binary (Continued)

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Representing Data, Pictures, Time, and Size in Computer
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Processing Data.
Binary and Hexadecimal Numbers
Binary Expression Numbers & Text CS 105 Binary Representation At the fundamental hardware level, a modern computer can only distinguish between two values,
Data Representation in Computers
Binary and Decimal Numbers
Introduction to Information Technology
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Number Systems & Logic Gates Day 1
Digital Data Patrice Koehl Computer Science UC Davis.
CREATED BY, MS. JENNIFER DUKE BITS, BYTES, AND UNITS OF MEASUREMENT.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Bits, Bytes, KiloBytes, MegaBytes, GigaBytes & TeraBytes.
Communications Technology 2104 Mercedes Lahey. Bit 1. bit=From a shortening of the words “binary digit” 2. the basic unit of information for computers.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Cosc175/data1 Data comprised of constants and variables information stored in memory Each memory location has an address Address - number identifying a.
Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 1 – Digital Systems and Information Logic.
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
Chapter 2 Computer Hardware
Data Representation CS280 – 09/13/05. Binary (from a Hacker’s dictionary) A base-2 numbering system with only two digits, 0 and 1, which is perfectly.
Data Representation A series of eight bits is called a byte. A byte can be used to represent a number or a character. As you’ll see in the following table,
Data Representation and Storage Lecture 5. Representations A number value can be represented in many ways: 5 Five V IIIII Cinq Hold up my hand.
Fill in the blanks: (1) _________ has only two possible values 0 and 1. (2) There are __________bits in a byte. (3) 1 kilobyte of memory space can store.
Bits & Bytes Created by Chris McAbee For AAMU AGB199 Extra Credit Created from information copied and pasted from
Lecture Binary and Hexadecimal Numbers. How Machines Think Computers handle two types of information: –Instructions –Data The "words" of a machine language.
What is a computer? A computer is a device that:
Bits and Bytes IGCSE. A binary number is either a 0 or a 1 and is known as a 'bit' or b inary dig it. However, the CPU cannot deal with just one bit at.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Computer Math CPS120: Lecture 3. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits have 0 or.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
Data Representation The storage of Text Numbers Graphics.
Data Representation (in computer system). Data Representation How do computers represent data? b The computers are digital Recognize.
Data Representation.
* Numeral Systems: A writing method for expressing numbers is called a “Numeral System". In the most common numeral system, we write numbers with combinations.
ASCII AND EBCDIC CODES By : madam aisha.
Overview 1-1 Information Representation
ABFC... Home page Introduction Binary number system Hexadecimal number system Binary coded decimal Objectives Octal number system Click.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
Understanding Computers
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Understanding Binary Understanding Computers. Understanding Computers L3 – Understanding Binary Learning Objectives All will Understand why all data is.
Understanding binary Understanding Computers.
Number Systems and Codes
3.1 Denary, Binary and Hexadecimal Number Systems
Introduction to Chapter 2
Information Support and Services
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
Lecture 3 ISE101: Computing Fundamentals
Representing Characters
Number Systems and Codes
Binary and Hexadecimal Numbers
Information Representation
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
Chapter Four Data Representation in Computers By Bezawit E.
Learning Intention I will learn how computers store text.
LO1 – Understand Computer Hardware
Beyond Base 10: Non-decimal Based Number Systems
UNIT – 3 & 4. Data Representation and Internal
Chapter 3 - Binary Numbering System
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Representing Information in Binary (Continued) SIMS-201 Representing Information in Binary (Continued)

Overview Chapter 3 continued: Binary Coded Decimal (BCD) Representing alphanumeric characters in binary form Bits, Bytes, and Beyond Representing real numbers in binary form Octal numbering system Hexadecimal numbering system Conversion between different numbering systems

Binary Coded Decimal (BCD) Representing one decimal number at a time How can we represent the ten decimal numbers (0-9) in binary code? Numeral 1 2 3 4 5 6 7 8 9 BCD Representation 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Binary Coded Decimal We can represent any integer by a string of binary digits. For example, 749 can be represented in binary as: 011101001001

How Many Bits Are Necessary to Represent Something? 1 bit can represent two (21) symbols either a 0 or a 1 2 bits can represent four (22) symbols 00 or 01 or 10 or 11 3 bits can represent eight (23) symbols 000 or 001 or 011 or 111 or 100 or 110 or 101 or 010 4 bits can represent sixteen (24) symbols 5 bits can represent 32 (25) symbols 6 bits can represent 64 (26) symbols 7 bits can represent 128 (27) symbols 8 bits (a byte) can represent 256 (28) symbols n bits can represent (2n) symbols! So…how many bits are necessary for all of us in class to have a unique binary ID? Are two bits enough? Three? Four? Five? Six? Seven?

To think about.. Can 64 bits represent twice as many symbols as 32 bits? 32 bit = 232 = 4,294,967,296 symbols 64 bit = 264 = 1.8 x 1019 symbols 128 bit = 2128 = 3.4 x 1038 symbols Can 8 bits represent twice as many symbols as 4 bits? 8 bit = 28 = 256 symbols 4 bit = 24 = 16 symbols Remember that we’re dealing with exponents! 8 bit is twice as big as __________? 7 bit! 7 bits can represent 27 possible symbols or 2x2x2x2x2x2x2 = 128 8 bits can represent 28 possible symbols or 2x2x2x2x2x2x2x2 = 256

Representing Alphanumeric Characters in Binary form (ASCII) It is important to be able to represent text in binary form as information is entered into a computer via a keyboard Text may be encoded using ASCII ASCII can represent: Numerals Letters in both upper and lower cases Special “printing” symbols such as @, $, %, etc. Commands that are used by computers to represent carriage returns, line feeds, etc.

ASCII is an acronym for American Standard Code for Information Interchange Its structure is a 7 bit code (plus a parity bit or an “extended” bit in some implementations ASCII can represent 128 symbols (27 symbols) INFT 101 is: 73 78 70 84 32 49 48 49 (decimal) or 1001001 1001110 1000110 1010100 0100000 0110001 0110000 0110001 in binary (using Appendix A from the textbook) A complete ASCII chart may be found in appendix A in your book How do you spell Lecture in ASCII?

Extended ASCII Chart This ASCII chart illustrates Decimal and Hex (Hexadecimal) representation of numbers, text and special characters Hex can be easily converted to binary Upper case D is 4416 416 is 01002 Upper case D is then 0100 0100 in binary

ASCII conversion example Let us convert You & I, to decimal, hex and binary using the ASCII code table : Y: 8910 5916 10110012 o: 11110 6F16 11011112 u: 11710 7516 11101012 Space: 3210 2016 01000002 &: 3810 2616 01001102 I: 7310 4916 10010012 ,: 4410 2C16 01011002

You & I, in Hex: You & I, in decimal: You & I, in binary: 59 6F 75 20 26 20 49 2C You & I, in decimal: 89 111 117 32 38 32 73 44 You & I, in binary: 1011001 1101111 1110101 0100000 0100110 0100000 1001001 0101100

Other Text Codes Extended Binary Coded Decimal Interchange Code (EBCDIC) used by IBM-- 8 bit (28 bits) 256 symbols Unicode is 16 bit (216) 65,536 symbols languages with accents (French, German) nonLatin alphabets (e.g. Hebrew, Russian) languages withough alphabets (e.g. Chinese, Japanese) www.unicode.org

Representing Real Numbers in Binary Form Previously, we learned how to represent integers in binary form Real numbers can be represented in binary form as well We will illustrate this with a thermometer example: A Mercury thermometer reflects temperature that can continuously vary over its range of measurement (an analog device) – temperature can take any value between say 60 and 70 degrees F. There is an infinite number of such possible temperatures. In order to perfectly represent that, a digital thermometer will need an infinite number of bits (which we can neither generate, store, nor transmit an infinite stream) So: if we are building a digital thermometer, we must make some choices to determine certain parameters: Precision (number of bits we will use) vs. the cost Accuracy (how true is our measurement against a given standard)

Suppose we want to measure the temperature range: -40º F to 140º F What is the range we wish to measure? How many bits are we willing to use? Suppose we want to measure the temperature range: -40º F to 140º F Total measurement range = 180º F If our thermometer needs to measure in 0.01º increments in order to be considered accurate, then we need to be able to represent 18,000 steps. (There are 180 degrees between -40º to 140º F. Since each degree can have 100 different values (with the 0.01º increments), then the number of possible values that the thermometer can measure is: 180x100=18,000) We can accomplish this with a 15 bit code (A 15 bit code can represent 215=32,768 different values-since we have 18,000 different values we have to represent, a code with 14 bits will not suffice, as a 14-bit code can only represent 214=16,384 values)

Thermometer Coding (One solution) 15 bit code

Thermometer Coding (Another solution)

Convenient Forms for Binary Codes Bits, Bytes, and Beyond

Bits vs. Bytes 1 Byte = 8 Bits Transmission Rates Measured in Bits Per Second 1 Byte = 8 Bits “Bits” are often used in terms of a data rate, or speed of information flow: 56 Kilobit per second modem (56 Kbps) A T-1 is 1.544 Megabits per second (1.544 Mbps or 1544 Kbps) “Bytes” are often used in terms of storage or capacity--computer memories are organized in terms of 8 bits 256 Megabyte (MB) RAM 40 Gigabyte (GB) Hard disk Computer Storage and Memory Measured in Bytes

Practical Use Everyday things measured in bits: 32-bit sound card 64-bit video accelerator card 128-bit encryption in your browser

Note! The Multipliers for Bits and Bytes are Slightly Different. “Kilo” or “Mega” have slightly different values when used with bits per second or with bytes. When Referring to Bytes (as in computer memory) Kilobyte (KB) 210 = 1,024 bytes Megabyte (MB) 220 = 1,048,576 bytes Gigabyte (GB) 230 = 1,073,741,824 bytes Terabyte (TB) 240 = 1,099,511,627,776 bytes When Referring to Bits Per Second (as in transmission rates) Kilobit per second (Kbps) = 1000 bps (thousand) Megabit per second (Mbps) = 1,000,000 bps (million) Gigabit per second (Gbps) = 1,000,000,000 bps (billion) Terabit per second (Tbps) = 1,000,000,000,000 bps (trillion)

More Multipliers for Measuring Bytes Kilobyte (K) 210 = 1,024 bytes Megabyte (M) 220 = 1,048,576 bytes Gigabyte (G) 230 = 1,073,741,824 bytes Terabytes (T) 240 = 1,099,511,627,776 bytes Petabytes (P) 250 = 1,125,899,906,842,624 bytes Exabytes (E) 260 = 1,152,921,504,606,846,976 bytes Zettabytes (Z) 270 = 1,180,591,620,717,411,303,424 bytes Yottabytes (Y) 280 = 1,208,925,819,614,629,174,706,176 bytes

Octal Numbering system There are other ways to “count ” besides the decimal and binary systems. One example is the octal numbering system (base 8). The Octal numbering system uses the first 8 numerals starting from 0 The first 20 numbers in the octal system are: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17 ,20, 21, 22, 23 Because there are 8 numerals and 8 patterns that can be formed by 3 bits, a single octal number may be used to represent a group of 3 bits

Octal numeral Bit pattern 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111

Start here For example, the number 1010010101112 may be converted to octal form by grouping the bits into 3, and looking at the table. Starting from the right, count 3 digits to the left. The first 3-bits are: 111, corresponding to 7. The next 3-bits are: 010, corresponding to 2. The next are 001, corresponding to 1 and the last 3-bits are 101, corresponding to 5 Hence, the above binary number may be represented by: 51278 in octal form

Hexadecimal Numbering system The hex system uses 16 numerals, starting with zero The standard decimal system only provides 10 different symbols So, the letters A-F are used to fill out a set of 16 different numerals We can use hex to represent a grouping of 4 bits

Decimal Hex Binary 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111

Start here For example, the number 1010110101112 may be converted to hexadecimal form by grouping the bits into 4, and looking at the table. Starting from the right, count 4 digits to the left. The first 4-bits are: 0111, corresponding to 716. The next 4-bits are: 1101, corresponding to D16. The last bits are: 1010, corresponding to A16 Hence, the above binary number may be represented by: AD716 in hexadecimal form

Conversion between different numbering systems Conversions are possible between different numbering systems: 1 - Binary to Decimal and vice versa 2 - Binary to Octal and vice versa 3 - Binary to Hex and vice versa 4 - Octal to Decimal and vice versa 5 - Hex to Decimal and vice versa 6 - Octal to Hex and vice versa

We learned how to do # 1 in detail in the previous lecture We learned how to do # 2 and 3 in this lecture We will learn how to do # 4, 5 and 6 next

Binary is base 2, octal is base 8 and hex is base 16 To convert octal and hex to decimal, we apply the same technique as converting binary to decimal. We recall that, in order to to convert from binary to decimal, we summed together the weights of the positions of the binary number that contained a “1”. Similarly, we sum the weights of the positions in the octal or hex numbers (depending on the base being used). Binary is base 2, octal is base 8 and hex is base 16 Two examples of octal to decimal conversion: 778 converted to decimal form: 7x81 + 7x80 = 6310 26358 converted to decimal form: 2x83 + 6x82 + 3x81 + 5x80 = 143710 Two examples of hex to decimal conversion: A516 is converted to decimal form by: 10x161 + 5x160 = 16510 F8C16 is converted to decimal form by: 15x162 + 8x161 + 12x160 = 398010 In order to convert from octal to hex (or vice versa), we first convert octal to binary, and then convert binary to hex.