Topic 14.1 Extended Hexadecimal

4
Topic 14.1 Extended Hexadecimal Decimal is base 10 and uses 10 digits (0,1,2,3,4,5,6,7,8,9). Binary is base 2 and uses 2 digits (0,1). Computers also use octal (base 8 with the digits 0,1,2,3,4,5,6,7). IB doesn’t require you to know about octal. A more common numbering system in use by computers is the hexadecimal or base 16 numbering system. As computers grew in storage capacity, the bigger system became necessary. Since a base 16 numbering system needs more than the ten digits we are familiar with, we have to make up new characters for the additional six digits. Here is the whole set of digits (in order) for the hexadecimal numbering system: (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Binary/decimal/hexadecimal conversions FYI: IB expects you to convert between decimal and binary, and hexadecimal and binary. The next page will explain how conversions from (hex) to (bin) work, and it is really quite easy.

description

Binary/decimal/ hexadecimal conversions.  Decimal is base 10 and uses 10 digits (0,1,2,3,4,5,6,7,8,9). Topic 14.1 Extended Hexadecimal.  Binary is base 2 and uses 2 digits (0,1).  Computers also use octal (base 8 with the digits 0,1,2,3,4,5,6,7). IB doesn’t require you to know about octal. - PowerPoint PPT Presentation

Transcript of Topic 14.1 Extended Hexadecimal

Page 1: Topic 14.1 Extended Hexadecimal

Topic 14.1 ExtendedHexadecimal

Decimal is base 10 and uses 10 digits (0,1,2,3,4,5,6,7,8,9).

Binary is base 2 and uses 2 digits (0,1).

Computers also use octal (base 8 with the digits 0,1,2,3,4,5,6,7). IB doesn’t require you to know about octal.A more common numbering system in use by computers is the hexadecimal or base 16 numbering system. As computers grew in storage capacity, the bigger system became necessary.Since a base 16 numbering system needs more than the ten digits we are familiar with, we have to make up new characters for the additional six digits. Here is the whole set of digits (in order) for the hexadecimal numbering system: (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

Binary/decimal/hexadecimal conversions

FYI: IB expects you to convert between decimal and binary, and hexadecimal and binary. The next page will explain how conversions from (hex) to (bin) work, and it is really quite easy.

Page 2: Topic 14.1 Extended Hexadecimal

Topic 14.1 ExtendedHexadecimal

We start by counting in binary to the decimal 15. Since we always start at zero, this will make 16 rows:

Binary/decimal/hexadecimal conversionsDecimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

10 1010

11 1011

12 1100

13 1101

14 1110

15 1111

Note that we need four bits to represent all the decimals from 0 to 15. Each group of four bits represents a single hexadecimal digit. A third column is added using the hexadecimal digits:

Hexadecimal

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

The shaded region represents the hexadecimal/binary conversion table.

FYI: IB expects you to be able to make this conversion table from scratch. Be sure you understand how to do it!

Page 3: Topic 14.1 Extended Hexadecimal

Topic 14.1 ExtendedHexadecimal

Here are some examples for the conversion from hexadecimal to binary:

Binary/decimal/hexadecimal conversionsDecimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

10 1010

11 1011

12 1100

13 1101

14 1110

15 1111

The number D(hex) = 1101(bin)

Hexadecimal

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

The number 2(hex) = 0010(bin)

The number 2D(hex) = 0010 1101(bin)

FYI: Be sure to always write hex to binary conversions as 4-bit strings (bunches).

FYI: To convert hex to decimal, simply convert to binary, and then use the process you’ve already learned:

2D(hex) = 0010 1101(bin)

= 32 + 8 + 4 + 1 = 45(dec)2D(hex) = 45(dec)

Page 4: Topic 14.1 Extended Hexadecimal

Topic 14.1 ExtendedHexadecimal

Here are some examples for the conversion from binary to hexadecimal:

Binary/decimal/hexadecimal conversionsDecimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

10 1010

11 1011

12 1100

13 1101

14 1110

15 1111

Hexadecimal

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

The number 0011(bin) = 3(hex) The number 11(bin) = 3(hex) too.

FYI: If your binary number doesn’t divide into groups of four, ADD LEADING ZEROS TO MAKE GROUPS OF FOUR.

The number 100011(bin) doesn’t break down into groups of four, unless we add two leading zeros: 100011(bin)=0010 0011(bin) = 23(hex) Convert 11110110101100011(bin) into hex:1 1110 1101 0110 0011(bin)

= 0001 1110 1101 0110 0011(bin)= 1 E D 6 3(hex) = 1ED63(hex)

Question: How many bits is contained in the number F129C0D(hex)?

Answer: Each hex digit is four bits (binary digits) so that the total number of bits is 4 7 = 28 bits.

Question: Many computers have “32-bit addresses” for memory location. How many hexadecimal digits are needed for addressing?

Answer: 32 / 4 = 8. Thus when you see an error message, you oftentimes also see a 32-bit location where the error appeared, in hexadecimal form: “Error occurred at FF0234C9,” for example.

Question: A byte is 8 bits. How many bytes are needed for addressing?

Answer: 32 / 8 = 4. You need 4 bytes for each address.