1 / 39

Binary Conversions

Binary Conversions. Number systems Binary to decimal Decimal to binary. Binary Humor. There are 10 kinds of people in the world - those who understand binary and those who don't. Numbering Systems. Base 10 or decimal numbering system

imatthew
Download Presentation

Binary Conversions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Binary Conversions • Number systems • Binary to decimal • Decimal to binary

  2. Binary Humor • There are 10 kinds of people in the world - those who understand binary and those who don't.

  3. Numbering Systems • Base 10 or decimal numbering system • Base-10 numbering systems dictate that the numbering scheme begins to repeat after the tenth digit (in our case, the number 9). • Zero is always the first number. • When we count, we usually count "00, 01, 02, 03, 04, 05 , 06, 07, 08, 09, 10, 11, 12, ...“

  4. Numbering Systems • Base 10 or decimal numbering system • Each digit to the left and right of the decimal point is given a name which identifies that digit's placeholder. • Each placeholder is a multiple of ten. • For now lets just consider positive numbers.

  5. Numbering Systems - Base Ten Each placeholder is a base of ten. • 10º = ones • Any number to the zero power is always equal to 1. • nº=1 • 10º=1 • 10¹ = tens • Any number to the first power is always equal itself. • n¹=n • 10¹=10 • 10² = hundreds • 10³ = thousands

  6. Numbering Systems – Base Ten • Arithmetic expression of 8 in 7408. • Work right to left of decimal point. • The ones position in expanded notation calculating the exponent. • 10º*8=8 is the same as 1*8=8

  7. Numbering Systems – Base Ten Sum of the powers of ten. 1000*7 + 100*4 + 10*0 + 1*8 = 7408

  8. Numbering Systems – Base two • Binary system is based on multiples of two. • In binary numbering the numbering scheme repeats after the second digit. • Let's count to five in binary: “0000, 0001, 0010, 0011, 0100, 0101“ • Binary numbering includes names for digit placeholders.

  9. Numbering Systems – Base two • Picture a odometer that is only capable of counting to two.

  10. Binary placeholders Ones Twos Fours Eights Sixteen's Thirty-twos Sixty-fours Decimal placeholders Ones Tens Hundreds Thousands Ten-thousands Hundred-thousands Millions Numbering Systems – Base two

  11. Numbering Systems – Base two • If the binary system is based on powers of 2, why is there still a "ones" position? • Remember: Anything to the zero power is always equal to 1. • In binary, the "ones" position is represented by the exponential expression 2º.

  12. Convert Binary to Decimal • Sum of the powers of two. • 8*1 + 4*1 + 2*0 + 1*1 = 13

  13. Convert Binary to Decimal • Step 1 - Write the binary number in a row, separating the digits into columns.

  14. Convert Binary to Decimal • Step 2 - I want to decide whether each digit placeholder is "ON" or "OFF.“ • "1" is "ON" and a "0" is "OFF.“ • We don't have to calculate any digit placeholders that are turned off.

  15. Convert Binary to Decimal • Step 3 - Write the exponential expressions ("powers of two") that represent each placeholder and multiply each expression by 1. • We do this only for the placeholders that are turned ON. • For the placeholders which are turned OFF, we simply bring down the zero from the number itself

  16. Convert Binary to Decimal • Step 4 - Calculate the exponents to get a simple multiplication expression for each placeholder.

  17. Convert Binary to Decimal • Step 5 - Solve the multiplication expressions from step #4.

  18. Convert Binary to Decimal • Step 6 - Add all the multiplication answers from step #5 together to get our decimal number

  19. Convert Binary to DecimalExample

  20. Covert Decimal to Binary • Step 1 - Take the decimal number and divide it by 2. • Important: NEVER carry your divisions past the decimal point!

  21. Covert Decimal to Binary • Step 2 - For each subsequent row, take the quotient from the previous row and divide it by two

  22. Covert Decimal to Binary • Step 3 – The remainder column only has ones or zeros. • The last cell in the remainder column of the last row must be a "1". • Read the 1s and 0s in the remainder column from the bottom to the top, we'll have our binary number!

  23. Covert Decimal to Binary Read

  24. Whiteboard Examples In Class Correction Read

  25. The last cell in the remainder column of the last row must be a "1“ because we need to use whole numbers (nonnegative integers).1 ÷ 2 = 0 because 1 can not be divided into, 1 is the remainder. Read Read

  26. Hexadecimal Conversation and ASCII

  27. Hexa + Decimal • Base-16 number system • It’s all Greek to me • “Sexa” = Latin = Six • “Decimal” = Latin = Ten • In 1963 IBM thought “Sexadecimal” was not politically correct • “Hexa” = Greek = Six • Since the western alphabet contains only ten digits, hexadecimal uses the letters A-F to represent the digits ten through fifteen.

  28. Hexadecimal and Computing • It is much easier to work with large numbers using hexadecimal values than decimal or binary. • One Hexadecimal digit = 4bits • Two hexadecimal digits = 8 bits • Eight bits=1 byte • This makes conversions between hexadecimal and binary very easy

  29. Counting Hexadecimal • Starting from zero, we count 00, 01, 02,03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F,10, 11, 12, 13, 14, 15, 16, 17 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20, 21, 22, 23, 24, 25,....

  30. Convert Hexadecimal to Decimal

  31. Convert Decimal to Hexadecimal Read • Quotient must be a whole number. • If decimal, multiply decimal portion by 16 for remainder. • Remainder must be a whole number.

  32. Convert Hexadecimal to Binary • Convert each hexadecimal digit into its 4-bit binaryequivalent. • 1AB

  33. Convert Binary to Hexadecimal • Converteach 4bit binary digit into its hexadecimalequivalent starting from the right. • If there is an odd number of bits, add zeros to the left to make a complete 4bit digit. • 110101011

  34. Uses • Web pages • http://www.psyclops.com/tools/rgb/ • Networking • MAC address • Programming • C, C++, C#, Java, Assembly • Geeky T-shirts • DEADB4C0FFEE

  35. ASCII • American Standard Code for Information Interchange • Each character is 7bits + 1bit for parity = 1byte • Represents English characters as numbers, with each letter assigned a number from 0 to 127 • This makes it possible to transfer data from one computer to another. • Used to store text files • http://www.pcguide.com/res/tablesASCII-c.html • http://nickciske.com/tools/binary.php

  36. Conversion Lab • Section I: Converting from Decimal to Binary • 1) 11 • 2) 27 • 3) 54 • 4) 113 • 5) 273 • Section II: Converting from Binary to Decimal • 6) 101 • 7) 1011 • 8) 10100 • 9) 111010 • 10) 1010001

  37. Conversion Lab • Section III: Convert Hexadecimal to Binary • 11) 43B • 12) DAB • 13) 954 • 14) C0FFEE • 15) B0A • Section IV: Convert Binary to Hexadecimal • 16) 11000001111 • 17) 10100011110 • 18) 100110 • 19) 11011110 • 20) 101110110001

  38. Conversion Lab • Section V: Convert Hexadecimal to Decimal • 21) FF2 • 22) 45 • 23) 19D • 24) 345 • 25) AA • Section VI: Convert Decimal to Hexadecimal • 26) 27 • 27) 85 • 28) 562 • 29) 4522 • 30) 5627

More Related