Presentation is loading. Please wait.

Presentation is loading. Please wait.

DH2T 34 – HNC Computer Architecture 1 Week 2 Introduction to the Hexadecimal Number System © C Nyssen/Aberdeen College 2004 All images © C Nyssen /Aberdeen.

Similar presentations


Presentation on theme: "DH2T 34 – HNC Computer Architecture 1 Week 2 Introduction to the Hexadecimal Number System © C Nyssen/Aberdeen College 2004 All images © C Nyssen /Aberdeen."— Presentation transcript:

1 DH2T 34 – HNC Computer Architecture 1 Week 2 Introduction to the Hexadecimal Number System © C Nyssen/Aberdeen College 2004 All images © C Nyssen /Aberdeen College unless otherwise stated Arc de Triomphe, compass, chess, caterpillar, binary printer all © romtech, with non-distribution licence Convict fish © Mark Pelissier, with permission Confused man © clipart.com, with non distribution licence Lady with Mark 1© Manchester University, with permission Prepared 7/9/04

2 The number 16 is not a “natural” counting base for 10-fingered humans. However it appears a lot in human society – because of the unique properties of the number 16. It is an exact square - 4 2, or 2 4.

3 The first four odd numbers added – equals 16. A compass rose is divided into 16 points. Chessboards have 16 black and 16 white pieces. They are divided into four quadrants of 16 squares each.

4 Bookbinders use a standard format of sixteenmo – the paper is divided into sixteen leaves. Pre-decimal Imperial weights and measures used 16oz to a pound. Caterpillars usually have 16 legs! (But only 6 when they become butterflies).

5 We saw last week that computers can only store and manipulate data in a binary base – base 2. The earliest computer programs were written in binary by highly trained mathematicians. They were, however, highly prone to errors….

6 … because the human eye becomes very confused when dealing with large groups of similar looking objects!

7 A method had to be found to “convert” large binary numbers to something that humans find easier to read and manipulate. As base 2 does not convert to base 10 very easily, we use base 16 – hexadecimal – instead.

8 You can buy special base-converting calculators to convert values between binary, decimal, hexadecimal and octal (a base of 8). Or a useful website is -

9 Each hexadecimal column uses a power of But we only have 10 digits – numbered 0 to 9 – so to make up 16 symbols, we use the letters A – F as well A B C D E F

10 Some examples of computers displaying information in a hexadecimal format…. h2.arch, h3.arch { align = "center"; background-color: ffcccc; } h1.java { font-size: 110%; font-family: trebuchet; background-color: 99ff66; }

11 Converting binary to hex is easy – exploiting the relationship between the numbers 4 and 16. Begin by dividing the binary number into “nibbles” – groups of 4 – working from right to left

12 Each nibble can only hold a value of between 0 and 15. Replace each nibble with the equivalent hexadecimal digit…. …and 16 binary digits have been replaced with 4 hexadecimal ones! or E310 or A

13 It works the other way round, too…. …expand each hexadecimal digit to four binary ones…. …and your 8-digit hexadecimal number has become a 32-bit binary one! E7F4C01D

14 Sometimes you will have to convert directly from decimal to hex…. …we use the long division process that we looked at last week with the binary conversion.

15 To convert a decimal number – to hexadecimal … …start by dividing by 16 … …and continue until you run out of numbers. (When dividing, just do the whole numbers, ignore the remainders for the moment…)

16 Now we turn our attention to the remainders – multiply them all by 16 to get the red column on the right….. …read from the BOTTOM UP to get 787DD4h … …or in binary!

17 To convert from hex to decimal, we use the “hexadecimal columns” method to multiply and add ’s256’s16’s1’s 5F7B 5 x 4096 = F or 15 x 256 = x 16 = 112 B or 11 x 1 = = 24443

18 You can, of course, convert from hex – binary – decimal if you prefer…. ….and back again from decimal – binary – hex…. DAF3h …because they all mean exactly the same value, it’s just expressed in different ways. Note that sometimes a lowercase ‘h’ is used to mean “hexidecimal base” DEFOh

19 It is important to remember that computers do not actually store things in hexadecimal. Everything is stored in binary! Computers just display things in hexadecimal to make life easier for the human audience

20 One for you to try….. FACE 16 in binary? in hex? 50D0FF

21 Summary  Although computers store and manipulate values in binary, they usually display them in hexadecimal format.  Each group of four bits corresponds to one hexadecimal digit.  Hexadecimal digits run from 0 -9 then A – F.  The value of each hexadecimal digit rises by a power of 16 as the columns move to the left.  Hexadecimal values are usually followed by a lowercase “h”, or a small 16.


Download ppt "DH2T 34 – HNC Computer Architecture 1 Week 2 Introduction to the Hexadecimal Number System © C Nyssen/Aberdeen College 2004 All images © C Nyssen /Aberdeen."

Similar presentations


Ads by Google