Announcement!!! First exam next Thursday (I’m trying to give you a first exam before the drop date) I’ll post a sample exam over the weekend and will try.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

Base Conversion COP Practice Problem  Print a String in reverse order:  For example, if we want to print “HELLO” backwards,  we first print:
1 CSCE Binary and Hexadecimal Numbers. Binary Numbers Computers store and process data in terms of binary numbers. Binary numbers consist of.
Number SystemsNumber Systems Modified By: AM. Sihan (Hardware Engineering)
How Computers Represent Information Yong Choi School of Business CSU, Bakersfield.
Computer Systems 1 Fundamentals of Computing
Prepared By Rama Gaikwad 1. Number Systems. Common Number Systems SystemBaseSymbols Used by humans? Used in computers? Decimal100, 1, … 9YesNo Binary20,
Hexadecimal Dk Izzati Pg Haji Ahmad.
Binary and Hexadecimal Numbers
Determine a node’s IP Network Address Gina Minks EME5603 Fall 2008 Final Project For EMC Employees.
Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school 
Numeral Systems Subjects: Numeral System Positional systems Decimal
Numbering Systems CS208.
Numeration Systems Introduction to Binary, Octal, and Hexadecimal.
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
Conversion of Number System Conversion Among Bases The possibilities: Hexadecimal DecimalOctal Binary
Data Representation in Computer Systems. 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers.
NUMBER SYSTEMS Prepared By K.Anitha Associate Professor Dept of ECE PVPSIT.
Lecture 2 Bits, Bytes & Number systems
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Number Systems Prepared by Department of Preparatory year.
Conversions Denary to Binary Method 1
Number System sneha.
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
Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.
Octal to Decimal Hexadecimal DecimalOctal Binary.
Data Representation Hexadecimal  Although computers work in binary it is sometimes inconvenient for humans to read everything in Binary. For example in.
Phys 4330 Digital ElectronicsBinary System Digital circuits process signals that contain just two voltage levels or states, labeled logic "0" and logic.
Computer Programming 12 Mr. Jean February 11 th, 2014.
NUMBER SYSTEMS.
Computer Number System
Programming 12 : Mr. Jean February 8 th, The plan: Video clip of the day Website Introduction to Hexadecimal Converting from Hexadecimal to Decimal.
1. Number Systems Chapt. 2 Location in course textbook.
ITEC 1011 Introduction to Information Technologies 1. Number Systems Chapt. 2 Location in course textbook.
1. Number Systems. Common Number Systems SystemBaseSymbols Used by humans? Used in computers? Decimal100, 1, … 9YesNo Binary20, 1NoYes Octal80, 1, … 7No.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
CMSC 1041 Binary / Hex Binary and Hex The number systems of Computer Science.
Numbering Systems and Conversion Understand How Computing Devices Work 1.
Number Systems. There are 10 kinds of people in the world, those who understand binary and those who don’t.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
Binary Numbers Press any key to begin.. In order to understand the binary numbering system lets first look at our decimal system. The decimal numbering.
Programmable Logic Controller
Computer Maintenance Numbering Systems Trade & Industrial Education
Binary, Denary, Hexadecimal Conversion Binary Addition
Binary and Hexadecimal
Octal to Decimal Decimal Octal Binary Hexadecimal.
1. Number Systems.
NUMBER SYSTEM Prepared by: Engr Zakria.
COMPUTING FUNDAMENTALS
ITE102 – Computer Programming (C++)
Location in course textbook
2.0 COMPUTER SYSTEM 2.2 Number System and Representation
Chapter 1 Number Systems & Conversions
Hexadecimal Conversions
Binary Numbers Press any key to begin..
Numbering Systems and Arithmetic operations on Hex, binary, and octal
Digital Electronics and Microprocessors
Number Systems.
Binary Lesson 4 Hexadecimal and Binary Practice
Number Systems created by: S.Shahrukh haider
Binary to Decimal Conversion
Hexadecimal.
Computer Science 1 Binary and Hexadecimal Numbers
Chapter 2 Number System.
1. Number Systems Chapt. 2.
Presentation transcript:

Announcement!!! First exam next Thursday (I’m trying to give you a first exam before the drop date) I’ll post a sample exam over the weekend and will try to go over it on Tuesday…. It will cover everything we’ve gone over so far….some intro computers, data types; I/O; if then else; Boolean operators; number systems

A pause……number systems..because I have to… What you need to know … 1. binary number system 2. converting from decimal to binary and binary to decimal 3. Hexadecimal system -- conversion

Why binary

Advantages The advantages of binary: –Simple; easy to build. –Unambiguous signals (hence noise immunity). –Flawless copies can be made. –Anything that can be represented with some sort of pattern can be represented with patterns of bits.

More advantages Since data of all kinds is stored in computer memory (main and secondary) using the same electronic methods, this means that endless perfect copies can be made of any type of data or program.

In order to understand the binary numbering system lets first look at our decimal system. The decimal numbering system consists of the numbers 0 through After nine we place a 1 in the tens column and start again with 0. Which gives us 10. The decimal system is also known as base 10 because it is based on the 10 numbers 0 – 9.

Binary Numbers have only two digits 0 or 1 DecimalBinary Binary is known as Base 2

Converting binary – decimal As you can see it would take a lot of time to create charts to represent Binary numbers. An easier way is to use the powers of = = = = = = = = 1 Lets place the above calculations into a chart that will make it easy to convert a binary number to a decimal number.

Converting Decimal to Binary Multiply each digit weight by the base power (i.e. 2) at that unit position and add up all the products

Remember how we “really” convert decimal to decimal => 5 x 10 0 = 5 2 x 10 1 = 20 1 x 10 2 = Base 125

x 1 = 1 Total = x 0 = 0 64 x 0 = 0 32 x 1 = x 0 = 0 8 x 1 = 8 4 x 0 = 0 Use the chart to convert the binary number to decimal. Note: The bit to the far right is the Least Significant Bit (LSB) and will determine if the number is even or odd. 2 x 0 = 0

x 1 = 1 Total = x 0 = 0 64 x 1 = x 1 = x 1 = 16 8 x 1 = 8 4 x 1 = 4 Use the chart to convert the binary number to decimal. 2 x 1 = 2 Note: if consecutive bits from the right are all 1’s Then the answer is the next power of 2 minus 1 In this case 128 – 1 = 127

x 0 = 0 Total = x 1 = x 0 = 0 32 x 1 = x 1 = 16 8 x 1 = 8 4 x 0 = 0 Take a piece of paper and convert the binary number to decimal. 2 x 1 = 2

Quick exercises Convert from binary to decimal. Convert from binary to decimal. Convert from binary to decimal.

The largest number that can be represented using an 8 bit binary number is Remember the rule – if all the digits are 1 then the number is the next power of 2 minus – 1 = 255

So….we need something else

Which Digits Are Available in which Bases 17 Base Base digits 2 digits Base A B C D E F digits Note: Base 16 is also called “Hexadecimal” or “Hex”. Base 16 Cheat Sheet A 16 = B 16 = C 16 = D 16 = E 16 = F 16 = Add Placeholder

Hexadecimal Numbers - Example 16 0 place16 1 place16 2 place 3AB 16 This subscript denotes that this number is in Base 16 or “Hexadecimal” or “Hex”. 1’s place16’s place256’s place Note: 16 2 = 256

Hexadecimal Numbers - Example 3AB 16 1’s place16’s place256’s place So this number represents 3 two-hundred fifty-sixes 10 sixteens 11 ones Base 16 Cheat Sheet A 16 = B 16 = C 16 = D 16 = E 16 = F 16 = Mathematically, this is (3 x 256) + (10 x 16) + (11 x 1) = =

Converting Hex to Decimal – Again we use the technique: Multiply each bit by 16 n, where n is the weight (or power) of the bit The weight is the position of the bit, starting from 0 on the right Add the results

Example ABC 16 => C x 16 0 = 12 x 1 = 12 B x 16 1 = 11 x 16 = 176 A x 16 2 = 10 x 256 =

Exercises Convert 3F3 to decimal Convert AA1 to decimal Convert 11A to decimal

Why Hexadecimal Is Important What is the largest number you can represent using four binary digits? _ _ ==== = … the smallest number? _ _ = 0 10 What is the largest number you can represent using a single hexadecimal digit? Base 16 Cheat Sheet A 16 = B 16 = C 16 = D 16 = E 16 = F 16 = _ 16 F = … the smallest number? _ 16 0 = 0 10 Note: You can represent the same range of values with a single hexadecimal digit that you can represent using four binary digits!

Why Hexadecimal Is Important It can take a lot of digits to represent numbers in binary. Example: = Long strings of digits can be difficult to work with or look at. Also, being only 1’s and 0’s, it becomes easy to insert or delete a digit when copying by hand.

Converting Decimal to Binary Technique –Divide by two, keep track of the remainder –First remainder is bit 0 (LSB, least significant bit) –Second remainder is bit 1 –Etc.

Converting Decimal to Binary Example: We want to convert to binary. 125 / 2 = 62 R 1 62 / 2 = 31 R 0 31 / 2 = 15 R 1 15 / 2 = 7 R 1 7 / 2 = 3 R 1 3 / 2 = 1 R 1 1 / 2 = 0 R =

Exercises Convert 33 decimal to Binary. Convert 51 decimal to Binary. Convert 19 decimal to Binary.

Converting Decimal to HEX Technique –Divide by 16, keep track of the remainder –First remainder is bit 0 (LSB, least significant bit) –Second remainder is bit 1 –Etc

Converting Decimal to Hex Example: We want to convert to hex. 125 / 16 = 7 R 13 7 / 16 = 0 R = 7D 16 Base 16 Cheat Sheet A 16 = B 16 = C 16 = D 16 = E 16 = F 16 = 15 10

Exercises Convert 28 to Hex Convert 346 to Hex Convert 117 to Hex

Converting Hex to Binary Technique –Convert each hexadecimal digit to a 4 bit equivalent binary representation (chop it into 4 digit representation

Converting Binary Numbers to Hex Recall the example binary number from the previous slide: First, split the binary number into groups of four digits, starting with the least significant digit. Next, convert each group of four binary digits to a single hex digit. CA52 Base 16 Cheat Sheet A 16 = B 16 = C 16 = D 16 = E 16 = F 16 = Put the single hex digits together in the order in which they were found, and you’re done! 16

Example 1 0 A F AF16 =

Exercise Convert to hex Convert AA1 (hex) to binary

Summary All programs and data are stored in binary as it maps directly to on/off signals Hexadecimal is base 16, every four binary digits can be represented by one Hex digit (Shorthand for computers) To convert any number base to decimal – Multiply each digit weight by the base power at that unit position and add up all the products To convert decimal to any base(2,16..) –Keep Dividing the decimal number by the base until you reach zero, keeping the remainders each time. Read from the bottom up.

Problems: Convert 101 to binary Convert to decimal Convert to hexadecimal

Real-world problems Convert the following MAC address to decimal, keeping a colon between each byte. fe:fd:00:00:5c:a4 Convert the following IP address to binary and hexadecimal, keeping a dot between each byte (remember a byte is 8 bits)

More real-world problems Convert the following subnet mask to binary, keeping a dot between each byte