SIMS-201 Representing Information in Binary. 2  Overview Chapter 3: The search for an appropriate code Bits as building blocks of information Binary.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

1 Chapter 2 The Digital World. 2 Digital Data Representation.
The Binary Numbering Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Binary number, Bits and Bytes and memory Sen Zhang.
Chapter 1 Data Storage. 2 Chapter 1: Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns.
Analogue and Digital Signals SL – Option C.1. Signals When talking about electronics we will talk about ‘signals’ –This is simply the transfer of information.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Binary Representation and Computer Arithmetic
Lecture #2 IT-101 Section 001 Introduction to Information Technology.
CENG 311 Machine Representation/Numbers
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Numeral Systems Subjects: Numeral System Positional systems Decimal
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
IT253: Computer Organization
Chapter 3 Data Representation
Chapter 2 Computer Hardware
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
Data Types and Representation CS French Chapter 6 + Chapter 7 – Number Bases.
1 IT 101 Spring, 2005 Department of Electrical and Computer Engineering Lecture Notes - 1.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Bits, Bytes, Words Digital signal. Digital Signals The amplitude of a digital signal varies between a logical “0” and logical “1”. – The information in.
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Data Representation in Computer Systems. 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers.
Analogue and Digital Signals SL – Option C.1 HL – Core 14.1.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
How Computers Work … and how you can work them. Art 315 Lecture 03 Dr. J Parker Fall 2010.
Chapter 1: Digital Computers and Information Illustration at beginning of each Chapter Base 10 Binary Base 2 Octal Base 8 Hex bas
CMSC 104, Lecture 051 Binary / Hex Binary and Hex The number systems of Computer Science.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Data Representation, Number Systems and Base Conversions
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
MECH1500 Chapter 3.
IP Addressing is Logical Addressing It works on Network Layer (Layer 3) Two Version of Addressing Scheme IP version 4 – 32 bit addressing IP version 6.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Chapter Nine: Data Transmission. Introduction Binary data is transmitted by either by serial or parallel methods Data transmission over long distances.
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.
Number systems. Binary system. Bits and bytes. Modern computers “speak” in a digital language composed of 2 digits. The machine language of modern computers.
Number Systems & Binary Arithmetic
Binary Number System And Conversion
INFS 211: Introduction to Information Technology
The Binary Number System and Conversions
CHAPTER 1 : INTRODUCTION
Introduction to Chapter 2
Introduction to Computers
Digital Electronics Jess 2008.
Chapter 3 Data Representation
Binary Number System And Conversion
Number Systems.
Binary Number System And Conversion
Chapter 1 Data Storage.
Decimal System The radix or base of a number system determines
The Binary Number System and Conversions
Binary Number System And Conversion
Numbering System TODAY AND TOMORROW 11th Edition
How Computers Store Data
Binary Representation
Chapter Four Data Representation in Computers By Bezawit E.
Chapter 3 - Binary Numbering System
Binary Number System And Conversion
Presentation transcript:

SIMS-201 Representing Information in Binary

2  Overview Chapter 3: The search for an appropriate code Bits as building blocks of information Binary to decimal conversion Decimal to binary conversion

3  Representing information in binary form In order to efficiently store, transmit, process and retrieve information, we need a process for encoding the information The encoding process is a method of representing information using a finite number of basic elements, called an alphabet Examples of written alphabets are: The English alphabet: 26 lower case, 26 upper case, 10 numbers and 32 special characters=94 characters The Chinese alphabet (Mandarin): 40, 000 characters A comparison between these alphabets shows us that the Chinese alphabet is a more powerful code as it can convey more information with a single complex character (symbol). Fewer characters are required to communicate an idea However, this code is very complex and the task of distinguishing one character from the other at the receiving end is highly challenging

4 We therefore would require a more robust scheme since reliable manipulation of information depends upon resistance to errors The fewer symbols the code has, the easier it is to distinguish the symbols from each other The code with the minimum number of symbols (2) is called the binary code It consists of two distinct symbols: 0 and 1 Any information can be coded using only these two symbols called bits: Binary digits

5 Why Use a Code with Only Two Values? A binary system is more resistant to errors The two symbols are highly distinguishable from one another. Consider a compact laser disc for music or computer storage: A CD is comprised of an enormous number of domains, each of which stores one bit. Each domain either has a smooth surface that reflects the laser or a “pit” which doesn’t reflect the laser. It’s very clear which of the two values is held by each domain. If, instead of 2 values, each domain held 3 values (domains of zero, partial, and high reflectivity) a simple fingerprint might create errors. The 2 clear values make the system simple and reliable. Two values correspond well to the “on” and “off” states of electronic switches that comprise digital computers.

6 Bits in the physical world Generation Varying the voltage in a circuit Varying the light intensity (ex: switch light on or off) Storage Magnetic disk: Magnetized in one of two directions: “up” or “down” Compact disc: Constructed to reflect or not reflect light using a reflective surface or pit Transmission media Electrical cables (wires) Optical fibers Air

7  Representing Information in Binary Form BInary digiTal symbols (BITs) form a universal language for any: Numbers Text Sound Images Video Anything else you can imagine… How is this possible???? How can numbers and text be represented in binary code????

8 How Do We Normally Represent Numbers? We normally don’t use Binary Digits (Bits) (in which a single placeholder can hold only 0 or 1) in everyday life. We use Decimal Digits - a single placeholder can hold one of ten numerical values between 0 and 9. Digits are combined together into larger numbers. For example: 8,234 is made up of 4 digits. The 4 holds the “1s place,” the 3 holds the “10s place,” the 2 holds the “100s place” and the 8 holds the “1000s place.” Before we discuss binary code, let’s think about the number system we use every day.

9 The Decimal System Decimal digits are combined to create larger numbers 4,567 => (4 x 10 3 ) + (5 x 10 2 ) + (6 x 10 1 ) + (7 x 10 0 ) 10 raised to the power of … 10 0 = = =10x10= =10x10x10=1, =10x10x10x10=10,000 and so on Also called Base-10 system There are other ways of representing numbers other than using the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. We have ten fingers and use ten digits! Coincidence?

10 Comparing the Decimal Number System to the Binary Number System While people routinely use decimal digits, computers use binary digits. The decimal system uses ten numbers (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) to represent all values. The binary system uses two numbers (0 and 1) to represent all values. In other words, computers use the “base-2” system rather than the “base-10” system. Counting in binary is simple (different, but simple) because you use powers of two instead of ten. Example follows.

11  Binary to Decimal Conversion The same as calculating the value of a decimal system number except use powers of two instead of powers of ten. The binary number 1101 can be converted to decimal as follows: (1x2 3 ) + (1x2 2 ) + (0x2 1 ) + (1x2 0 ) = = 13 The binary number 1101 can be converted to decimal as follows: (1x2 3 ) + (1x2 2 ) + (0x2 1 ) + (1x2 0 ) = = 13 For understanding binary, it’s helpful to have a good command of powers of 2: For understanding binary, it’s helpful to have a good command of powers of 2: 2 0 = = = 2x2 = = 2x2x2 = = 2x2x2x2 = = 2x2x2x2x2 = = 2x2x2x2x2x2 = = 2x2x2x2x2x2x2 = = 2x2x2x2x2x2x2x2 = = 2x2x2x2x2x2x2x2x2 = = 2x2x2x2x2x2x2x2x2x2 = 1024 and so on...

12 Binary versus Decimal Numbers 2s place 1s place 4s place 8s place Another Way to Think About It s place 10s place 1s place 100s place 1,000s place 9 5, ,000s place 9 x 10,000 = 90, x 1,000 = 5, x 100 = x 10 = x 1 = 7 _______________ = 95,107 (10) 1 x 16 = x 8 = x 4 = x 2 = x 1 = 1 _______________ = 21 (10) Decimal Number Binary Number

13 Another Example: Converting Binary to Decimal A computer generates the following sequence of bits: (2) How do we convert (2) into decimal? (1x2 5 ) + (1x2 4 ) + (0x2 3 ) + (1x2 2 ) + (0x2 1 ) + (1x2 0 ) (1x2 5 ) + (1x2 4 ) + (0x2 3 ) + (1x2 2 ) + (0x2 1 ) + (1x2 0 ) = = 53 (10) = = 53 (10) (2) = 53 (10)

14 Real World Example: The Internet Address An Internet address, known as an IP address for “Internet Protocol” is comprised of four binary octets, making it a 32-bit address. IP addresses, difficult for humans to read in binary format, are often converted to “dotted decimal format.” To convert the 32-bit binary address to dotted decimal format, divide the address into four 8-bit octets and then convert each octet to a decimal number. Each octet will have one of 256 values (0 through 255) Converting a 32-bit Internet address into dotted decimal format (IP address in dotted decimal form)

15 Real World Example: The Internet Address Convert the following 32-bit Internet address into dotted decimal format: ) Divide the IP address into four octets ) Convert each binary octet into a decimal number = = = 16+4 = = = = = 220 3) Write out the decimal values separated by periods

16  Decimal to Binary Conversion Sometimes it can be done intuitively. For example: The decimal number 1 represented in 8-bit binary is: The decimal number 128 represented in 8-bit binary is: The decimal number 129 represented in 8-bit binary is: The decimal number 2 represented in 8-bit binary is: The decimal number 4 represented in 8-bit binary is: The decimal number 6 represented in 8-bit binary is: But what are we really doing mathematically?

17 ____ ____ ____ ____ ____ ____ ____ ____ Convert the Decimal Number 174 to a binary octet ____ ____ ____ ____ ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place Step 1: Compare 174 to >128 so place a 1 in the 128s place and subtract = 46 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place 1 Step 2: Compare 46 to <64 so place a 0 in the 64s place and continue with 46. 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place 1 0 ____ ____ ____ ____ ____ ____ ____ ____

18 Reversing the Process: Converting a Decimal Number to Binary ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place Step 3: Compare 46 to >32 so place a 1 in the 32s place and subtract = 14 ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place 1 Step 4: Compare 14 to <16 so place a 0 in the 16s place and continue with 14. ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place Step 5: Compare 14 to 8. 14>8 so place a 1 in the 8s place and subtract 14-8=6. 101

19 ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place 0 Step 6: Compare 6 to 4. 6>4 so place a 1 in the 4s place and subtract 6-4= ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place 0 Step 7: Compare 2 to 2. 2=2 so place a 1 in the 2s place and subtract 2-2=0. There is no remainder left to convert, so also place a 0 in the 1s place ____ ____ ____ ____ 1s place 2s place 4s place 8s place 16s place 32s place 64s place 128s place The decimal number 174 has been converted to the binary number

20 Binary Conventions Most Significant Bit (MSB) and Least Significant Bit (LSB) Decimal Example: 64 6 is the Most Significant Digit 4 is the Least Significant Digit Binary: is the MSB 0 on the right is the LSB Subscripts: Note that the subscript “2” makes it clear a number is in binary format and the subscript “10” makes it clear a number is in decimal format. This avoids confusion between a number like which can either be binary, written as (2) or decimal, written as 110,101 (10)

21 If there is a “1” in the LSB of a binary number, then its decimal equivalent is an odd number If there is a “0” in the LSB of a binary number, then its decimal equivalent is an even number

22 In-Class Examples Convert 12 (10) to binary representation Convert (2) to decimal Convert 256 (10) to binary representation Convert (2) to decimal

23 Exercises Convert the following to binary form: Convert the following to decimal form: