© Maths Support Service 2007 Binary and Hexadecimal Numbers Next Slide AE98FD AE98FD
© Maths Support Service 2007 Decimal Number System Ten Digits, so it is said to be base 10 0,1, 2, 3, 4, 5, 6, 7, 8, 9 Ten fingers Each position in the decimal system represents 10 n 4567 = 7 X X X X 10 3 Previous Slide Next Slide
© Maths Support Service 2007 Base 5 0,1, 2, 3, 4, 10,11,12,13,14, 20, 21, 22, 23, 24, 30, 31, 32,33, 34, 40, 41,42,43, 44, 100, 101 etc Previous Slide Next Slide
© Maths Support Service 2007 Binary System Two digits, so it is base 2 0 and 1 0,1,10,11,100,101 etc Each position in a binary number represents 2 n Thus 10101= 1 X X X X X 2 4 Previous Slide Next Slide Fancy a class game of Binary or Buzz
© Maths Support Service 2007 Activities 4, 5,6, 7 Base 10 = decimal Base 2 =binary 2356= 6 X X X X = 1 X X X X X X = 1 X X X X X X 2 5 Previous Slide Next Slide
© Maths Support Service 2007 Adding Binary Numbers Previous Slide Next Slide
© Maths Support Service 2007 Subtraction Binary Numbers Previous Slide Next Slide
© Maths Support Service 2007 Activities 8 and Add Subtract Previous Slide Next Slide
© Maths Support Service 2007 Convert 47 in Decimal to Binary 47 / 2 = 23 rem 1 23 / 2 = 11 rem 1 11 / 2 = 5 rem 1 5 / 2 = 2 rem 1 2 / 2 = 1 rem 0 Hence 47 in decimal format equals in binary format. Previous Slide Next Slide
© Maths Support Service 2007 Alternative Method to convert from Decimal to Binary Look for the highest power of 2 that divides into 47, subtract it from 47, then look for the highest power of 2 that goes into the remainder and subtract it from the remainder, repeat until you arrive at one or zero. 47 = 1 (32) + 0(16) + 1(8) +1(4) + 1(2) +1(1) So 47 equals in binary 29= 1 (16) + 1(8) + 1(4) + 0(2) + 1(1) So 29 = in binary Previous Slide Next Slide
© Maths Support Service 2007 Convert Binary to Decimal X 160 X 81 x 41 x 21 X = 23 Previous Slide Next Slide
© Maths Support Service 2007 Activities 10,11,12, Previous Slide Next Slide
© Maths Support Service Digits instead of 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A So numbers go 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, 10,11,12,13,14,15,16,17,18,19,1A, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 30 Previous Slide Next Slide
© Maths Support Service 2007 Hexadecimal 16 DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Numbers go 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20 etc Previous Slide Next Slide
© Maths Support Service 2007 Uses of Hexadecimal Computer operations are done by binary systems. One and Zero or on and off or yes and no. Because of the large nature of binary numbers, when talking computer code, they are normally represented in hexadecimal format. These can be addresses of RAM. The hexadecimal notation is often used in error messages. Sometimes it is used in obscure web addresses. Also used in HTML code to convey the background colour required. Previous Slide Next Slide
© Maths Support Service 2007 HTML Color The background colour of a webpage is made up of a combination of three colours, red, green and blue. Note the background can also be a picture. Each colour is allowed to be represented by two hexadecimal digits in the order red, green and blue. This is known as the RGB color code. For each hexadecimal digit there is a choice of 16, so for 6 digits there is a choice of 16 x 16 x 16 x 16 x1 6 x 16. Over 1.6 million colours. Note mixing colours in HTML is not the same as mixing paint. Previous Slide Next Slide
© Maths Support Service 2007 To see HTML Color in action Go to START, All Programs, Accessories and Notepad. Type in the following code: Save as color.html in My Documents. Notice it has to have.html at the end. Go to My Documents and open. Click to see in action. Now change the hex colour codes in your Notepad program, save and refresh to see new colours. This could be done in a computer room or with a classroom computer and data projector. Previous Slide Next Slide
© Maths Support Service 2007 Special Color codes Black White FFFFFF Red FF0000 Green 00FF00 Blue 0000FF Gray or the same amount of each colour. Yellow F0F0000 Orange FF7000 Brown Previous Slide Next Slide
© Maths Support Service 2007 Convert Binary to Hexadecimal Any combination of 4 binary digits together will always represent the decimal numbers 0 to 15. Divide the binary number into groups of 4, from right to left. To convert binary to hexadecimal, 1101 equals 13, which is D and 1000 equals 8. So in binary equals 8D in hexadecimal. If there are less than 4 digits on the left add zeros to the left. For example , is divided into 0111 and 0010 and hence equals 27 in hexadecimal. Previous Slide Next Slide
© Maths Support Service 2007 Convert Hexadecimal to Binary For example 2D4F 2=0010 D=1101 4=0100 F=1111 Then 2D4F= Previous Slide Next Slide
© Maths Support Service 2007 Convert Hexadecimal to decimal For example D67F D67F=13 X X X Previous Slide Next Slide
© Maths Support Service 2007 Convert Decimal to Hexadecimal Best way is to go decimal to binary and then binary to hexadecimal. Previous Slide Next Slide
© Maths Support Service 2007 Conversion table decimal_hexadecimal.htmhttp:// decimal_hexadecimal.htm Previous Slide Next Slide