22
Hexadecimal Binary Made Easier

Hexadecimal

  • Upload
    faxon

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

Hexadecimal. Binary Made Easier. Quick Recap. Two different systems Computers use binary Binary is hard to read What is 1010001010111011??. Middle Ground. Need a system: Easier to read Converts easily to binary. Middle Ground. Need a system: Easier to read Converts easily to binary - PowerPoint PPT Presentation

Citation preview

Page 1: Hexadecimal

HexadecimalBinary Made Easier

Page 2: Hexadecimal

Quick Recap

• Two different systems– Computers use binary– Binary is hard to read

• What is 1010001010111011??

System Base SymbolsUsed by humans?

Used in computers?

Decimal 10 0, 1, … 9 Yes No

Binary 2 0, 1 No Yes

Page 3: Hexadecimal

Middle Ground

• Need a system:– Easier to read– Converts easily to binary

Page 4: Hexadecimal

Middle Ground

• Need a system:– Easier to read– Converts easily to binary

• Hexadecimal – base 16

Page 5: Hexadecimal

Hexdecimal

• Base 16– Each column is a power of 16:

= 4096 * 2 + 256 * 0 + 16 * 5 + 1 * 9= 8192 + 80 + 9205916 = 8281 in decimal

4096’s163

256’s162

16’s161

1’s160

2 0 5 9

Page 6: Hexadecimal

13?

• How do we represent 13???

4096’s163

256’s162

16’s161

1’s160

Page 7: Hexadecimal

13?

• How do we represent 13???– Use 0-9, A (10), B (11), C (12), D (13), E (14), F (15)

4096’s163

256’s162

16’s161

1’s160

D

Page 8: Hexadecimal

16 Values

• Each column needs 16 values 0-15– Use 0-9, A (10), B (11), C (12), D (13), E (14), F (15)

= 256 * 1 + 16 * 14 + 1 * 9= 256 + 224 + 9= 489

4096’s163

256’s162

16’s161

1’s160

1 E 9

Page 9: Hexadecimal

Counting

• Equivalent values : 1210 = 11002 = C16

Decimal Binary Hex

0 0 0

1 1 1

2 10 2

3 11 3

4 100 4

5 101 5

6 110 6

7 111 7

Decimal Binary Hex

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

Decimal Binary Hex

16 10000 10

17 10001 11

18 10010 12

19 10011 13

20 10100 14

21 10101 15

22 10110 16

23 10111 17

Page 10: Hexadecimal

Conversion Among Bases

• The possibilities:

Hexadecimal

Decimal

Binary

Page 11: Hexadecimal

Hex & Binary

• Each hex digit = 16 possible values• 4 binary digits = 16 possible values (24)• 1 hex digit = 4 binary digits

Decimal Binary Hex

0 0 0

1 1 1

2 10 2

3 11 3

4 100 4

5 101 5

6 110 6

7 111 7

Decimal Binary Hex

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

Page 12: Hexadecimal

Binary -> Hex

• Break binary value into groups of 4:1001110100010110

Page 13: Hexadecimal

Binary -> Hex

• Break binary value into groups of 4:1001110100010110

• Replace each group with 1 hex digit

Binary Hex

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F

Page 14: Hexadecimal

Binary -> Hex

• Break binary value into groups of 4:1001110100010110 9 D 1 6

• Replace each group with 1 hex digit

10011101000101102 = 9D1616

Binary Hex Decimal

0000 0 0

0001 1 1

0010 2 2

0011 3 3

0100 4 4

0101 5 5

0110 6 6

0111 7 7

1000 8 8

1001 9 9

1010 A 10

1011 B 11

1100 C 12

1101 D 13

1110 E 14

1111 F 15

Page 15: Hexadecimal

Hex -> Binary

• Replace each hex digit with 4 binarydigits:

• Ex: F2

F 2 1111 0010

F216 = 111100102

Binary Hex

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F

Page 16: Hexadecimal

Hex Decimal

Use a tableDigits 0-FA = 10B = 11C = 12D = 13E = 14F = 15

4096’s163

256’s162

16’s161

1’s160

Page 17: Hexadecimal

Hex Decimal

Use a tableDigits 0-FA = 10B = 11C = 12D = 13E = 14F = 15

4096’s163

256’s162

16’s161

1’s160

1 C 7

256 x 1 + 16 x 12 + 1 x 7 = 256 + 192 + 7

= 455

1C716 = 45510

Page 18: Hexadecimal

Decimal Hex

Division / Multiplication methods:

Current Value Quotient Remainder

455 ÷ 16 28 7 7

28 ÷ 16 1 12 (C) C71 ÷ 16 0 1 1C7

Page 19: Hexadecimal

Summary

• Hex is a bridge:– Easier for us– Still just binary for computers

System Base SymbolsUsed by humans?

Used in computers?

Decimal 10 0, 1, … 9 Yes No

Binary 2 0, 1 No Yes

Hex 16 0-9ABCDEF

No, butbetter than

binary

No, but easily translates to

binary

Page 20: Hexadecimal

Colors

• Monitors make colors by mixing red/green/blue light:

• Typical 24 bits : 8 bits for each color– 28 = 256 possible values

Page 21: Hexadecimal

Colors

• Hex Colors– Each color stored as 0-255– 8 bits– 2 hex digits

Page 22: Hexadecimal

Web Colors

• Website colors often written in hex#RRGGBB– Two digits for red, two for green, two for blue

Black #000000 (0,0,0) White #FFFFFF (255,255,255) Red #FF0000 (255,0,0) Lime #00FF00 (0,255,0) Blue #0000FF (0,0,255) Yellow #FFFF00 (255,255,0) Cyan / Aqua #00FFFF (0,255,255)