Binary 1 Basic conversions.

Slides:



Advertisements
Similar presentations
DATA REPRESENTATION CONVERSION.
Advertisements

The Binary Numbering Systems
James Tam Beyond Base 10: Non-decimal Based Number Systems What exactly is decimal? How do other number systems work (binary, octal and hex) How to convert.
How Computers Represent Numbers Friday, Week 5. Binary Code A series of 1’s and 0’s Place value is in powers of 2.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Level ISA3: Information Representation
Data Representation in Computers
Lesson 2 0x Coding ASCII Code.
Binary Numbers.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
CODING SYSTEMS CODING SYSTEMS CODING SYSTEMS. CHARACTERS CHARACTERS digits: 0 – 9 (numeric characters) letters: alphabetic characters punctuation marks:
Converting binary to decimal decimal to binary
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary.
Binary Arithmetic & Data representation
Chapter 3 Section 1 Number Representation Modern cryptographic methods, unlike the classical methods we just learned, are computer based. Representation.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
2nd Week of EOG Review Book
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
BINARY 1. Number Systems Base 10 uses the numbers 0-9 Represents numbers as ones, tens, hundreds etc HundredsTensOnesSolution = =
Number systems, Operations, and Codes
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Data Representation, Number Systems and Base Conversions
Representation of Characters
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Introduction To Number Systems Binary System M. AL-Towaileb1.
Representing Characters in a Computer System Representation of Data in Computer Systems.
Information Coding Schemes Group Member : Yvonne Tiffany Jurifah bt Junaidi Clara Jane George.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Understanding Computers
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.
Introduction to signals The signals are broadly classified into two categories: 1. Analog Signals. 2. Digital signals.
Understanding Binary Understanding Computers. Understanding Computers L3 – Understanding Binary Learning Objectives All will Understand why all data is.
Some basic concepts underlying computer archi­tecture
Introduction To Number Systems
Understanding binary Understanding Computers.
Unit 2.6 Data Representation Lesson 2 ‒ Characters
NUMBER SYSTEMS.
Arithmetic Shifts and Character Representation
Lecture No. 4 Number Systems
Number Representation
By: Jonathan O. Cabriana
CSCI 198: Lecture 4: Data Representation
CSCI 161: Lecture 4: Data Representation
Chapter 3 Data Representation
Number System conversions
Number Systems.
Data Encoding Characters.
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Representing Characters
Dr. Clincy Professor of CS
Numbering System TODAY AND TOMORROW 11th Edition
Fundamentals of Data Representation
COMS 161 Introduction to Computing
Chapter 2: Number Systems
COMS 161 Introduction to Computing
How Computers Store Data
Beyond Base 10: Non-decimal Based Number Systems
COMS 161 Introduction to Computing
ASCII LP1.
Introduction To Number Systems
Chapter 3 - Binary Numbering System
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Binary 1 Basic conversions

Base 10 uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 represents digits as multiples of 1, 10, 100, 1000, etc… 100 10 1 594 5 9 4 500 + 90 + 4 = 594 42 2 0 + 40 + 2 = 42 420 400 + 20 + 0 = 420 402 400 + 0 + 2 = 402

Base 2 (Binary) Uses the digits 0, 1 Each column represents a “power of two” 0s and 1s are known as “bits”, short for “binary digits” 128 64 32 16 8 4 2 1 Decimal 16 + 1 = 17 64 + 16 + 2 = 82 128 + 4 = 132 128 + 64 + 8 + 1 = 201

Binary to decimal… practise! 128 64 32 16 8 4 2 1 Decimal 0010 1100 0101 1000 1010 0011 1100 0011 1111 1000 0111 0001 0101 0101 0110 0110 1111 1111

Solutions Binary 128 64 32 16 8 4 2 1 Decimal 0010 1100 32 + 8 + 4 = 44 0101 1000 64 + 16 + 8 = 88 1010 0011 128 + 32 + 2 + 1 = 163 1100 0011 128 + 64 +2 + 1 = 195 1111 1000 128 + 64 + 32 + 16 + 8 = 248 0111 0001 64 + 32 + 16 + 1 = 113 0101 0101 64 + 16 + 4 + 1 = 85 0110 0110 64 + 32 + 4 + 2 = 102 1111 1111 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

What about going the other way? For example, how might we determine the binary equivalent of each of the following decimals? 4 16 17 15 12 39

Decimal to binary – One method Find the highest power of two that is less than the number you want to convert, then subtract, and repeat. Convert 39 into binary Does 128 fit into 39? No 0 Does 64 fit into 39? No 0 Does 32 fit into 39? Yes 1 What’s left over? 39-32 = 7 Does 16 fit into 7? No 0 Does 8 fit into 7? No 0 Does 4 fit into 7? Yes 1 What’s left over? 7-4 = 3 Does 2 fit into 3? Yes 1 What’s left over? 3-2 = 1 Does 1 fit into 1? Yes 1 What’s left over? 1-1=0 Decimal 39 => binary 0010 0111

Decimal to binary… practise! 128 64 32 16 8 4 2 1 Binary 5 19 27 35 49 87 232 240

Solutions Decimal 128 64 32 16 8 4 2 1 Binary 5 0000 0101 19 0001 0011 27 0001 1011 35 0010 0011 49 0011 0001 87 0101 0111 232 1110 1000 240 1111 0000

Binary fractions We can convert fractions in much the same way as whole numbers Binary 2 1 . ½ .5 ¼ .25 1/8 .125 1/16 .0625 1/32 .03125 1/64 .015625 Decimal 1.1 1 + 0.5 = 1.5 10.011 2 + 0.25 + 0.125 = 2.375 0.0111 0.25 + 0.125 + 0.0625 = 0.4375 11.100101 2 + 1 + 0.5 + 0.0625 + 0.015625 = 3.578125

Binary fractions What if the fractions we want to convert from decimal to binary aren’t “easy”? 0.4 0.85 Division by 2 We repeatedly divide a number by two to get the final solution

Convert decimal 0.4 to binary Multiply by 2 Put the whole number part in one column Put the remainder in the next column Copy the remainder to the start of the next row Repeat There is no rule how many times you should do this, but five “binary places” will be fine for us The “whole number” column, read from top to bottom, is the binary fraction Decimal Whole number Remainder 0.4 x 2 = 0.8 1 0.6 0.2 Therefore 0.4 => 0.0110011… 0.410 = 0.011002 (to 5 binary places)

Decimal fractions to binary… practise! Convert 0.3 to binary Convert 0.24 to binary Decimal Whole number Remainder 0.3 x 2 = Decimal Whole number Remainder 0.24 x 2 =

Data representation How could we send a secret message to someone else using only binary digits (bits)? How many bits would be needed per letter? What if we wanted to use upper and lower case letters? What about all the other symbols on the keyboard? (and don’t forget the characters that aren’t displayed, such spaces, tabs, line breaks, etc.)

ASCII ASCII Decimal Binary … ? 63 0011 1111 @ 64 0100 0000 A 65 0100 0001 B 66 0100 0010 C 67 0100 0011 D 68 0100 0100 E 69 0100 0101 F 70 0100 0110 G 71 0100 0111 H 72 0100 1001 I 73 0100 1010 J 74 0100 1011 K 75 0100 1100 “ASCII” (American Standard Code for Information Interchange) encodes 128 characters into 7-bit binary integers. Eight-bit machines typically set the eighth (left-most) bit to 0. It was originally based on the English alphabet, and includes both printable and non- printable characters. It was the most common character-encoding scheme on the web until 2007.

Unicode What if we want to represent more than just English characters? Unicode is a system for providing support for many different languages. Unicode can be implemented in different ways, but the most common are UTF-8 (8 bits) or UTF-16 (16 bits). Unicode is a superset of ASCII, the numbers 0-127 have the same meaning in ASCII as they do in Unicode. The latest definition of Unicode includes almost 100,000 characters.

ASCII characters Convert the following using the ASCII table: Decimal # 100 F 84 p 32

Solutions Character Decimal # 35 d 100 F 70 T 84 p 112 (space) 32