430 likes | 1.01k Views
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
E N D
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 • Hexadecimal – base 16
Hexdecimal • Base 16 • Each column is a power of 16: = 4096 * 2 + 256 * 0 + 16 * 5 + 1 * 9 = 8192 + 80 + 9 205916 = 8281 in decimal
13? • How do we represent 13???
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
Counting • Equivalent values : 1210 = 11002 = C16
Conversion Among Bases • The possibilities: Decimal Hexadecimal Binary
Hex->Decimal Use a table: Remember that A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Hex & Binary • Each hex digit = 16 possible values • 4 binary digits = 16 possible values (24) • 1 hex digit = 4 binary digits
Binary -> Hex • Break binary value into groups of 4:1001110100010110
Binary -> Hex • Break binary value into groups of 4:1001110100010110 • Replace each group with 1 hex digit
Binary -> Hex • Break binary value into groups of 4:10011101000101109 D 1 6 • Replace each group with 1 hex digit 10011101000101102 = 9D1616
Hex -> Binary • Replace each hex digit with 4 binarydigits: • Ex:F2 F 21111 0010 F216 = 111100102
Hex->Decimal Use a table: Remember that A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Decimal -> Hex • Go to binary then to hex OR • Divide by 16, remainder is digit, keep going with quotient • Build right left • Ex: 455:
Summary • Hex is a bridge: • Easier for us • Still just binary for computers
Colors • Colors can be represented as red, green and blue values • Each color stored as 0-255 http://www.rapidtables.com/web/color/RGB_Color.htm
0-255 • 0-255 = 256 values • 256 = 28 = 162 • Each color is 8 bits or 2 hex digits • 3 * 8 = 24, hence 24 bit color
Web Colors • Website colors often written in hex #RRGGBB • Two digits for red, two for green, two for blue