Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Hexadecimal Number System and Memory Addressing ISAT 121.

Similar presentations


Presentation on theme: "The Hexadecimal Number System and Memory Addressing ISAT 121."— Presentation transcript:

1 The Hexadecimal Number System and Memory Addressing ISAT 121

2 2 Familiar Number Systems Roman numerals None, one, few, many Positional value systems Each position in a number has a value Includes concept of zero Example: decimal system

3 3 Characteristics of Numbering Systems 1) The digits are consecutive. 2) The number of digits is equal to the size of the base. 3) Zero is always the first digit. 4) The base number is never a digit. 5) When 1 is added to the largest digit, a sum of zero and a carry of one results. 6) Numeric values determined by the have implicit positional values of the digits.

4 4 Significant Digits Binary: 11101101 Most significant digit Least significant digit Hexadecimal: 1D63A7A Most significant digit Least significant digit

5 5 History Necessity for understanding numbering systems Historical numbering systems in computing Decimal On/Off Binary (Ada) Bits & bytes ASCII

6 6 Common terminology TermDefinition Bit A numeral in the binary number system: a 0 or a 1. Byte 8 bits (the smallest addressable memory location). Kilobyte 1024 bytes, which is 2 to the 10th power, often rounded to 1000 bytes. Megabyte Either 1024 kilobytes or 1000 kilobytes, depending on what has come to be standard practice in different situations. For example, when calculating floppy disk capacities, 1 megabyte = 1000 kilobytes; when calculating hard drive capacity, traditionally, 1 megabyte = 1024 kilobytes.

7 7 Common terminology TermDefinition Gigabyte 1000 megabytes or 1024 megabytes, depending on what has come to be standard practice in different situations. ASCII American Standard Code for Information Interchange coding scheme used for microcomputers, which assigns a 7- or 8-bit code to all characters and symbols. See Appendix B for more information. Hex Short for hexadecimal. A number system based on 16 values (called base 16), which is explained in this appendix. Uses the 16 numerals 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Hex numbers are often followed by a lowercase h to indicate they are in hex (example: 78h).

8 8 Example / 2 30 = In the lab… 1. Double click on My Computer 2. Right click on C: 3. Click on Properties

9 9 Decimal Number System Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base Ten Each position is power of 10 Value = Σ i=0.. n-1 d i * 10 i, n is count of digits in number

10 10 Decimal Number Example Number: 1946 n = 4 and n – 1 = 3 Positions 1 * 10 3 = 1000 9 * 10 2 = 900 4 * 10 1 = 40 6 * 10 0 =6 Sum:1946

11 11 Binary Number System Also called the “Base 2 system” The binary number system is used to model the series of electrical signals computers use to represent information 0 represents the no voltage or an off state 1 represents the presence of voltage or an on state

12 12 Binary Number System Digits: 0, 1 Base: Two Each position is power of 2 Example: 1010 1000 [2] 1*2 7 + 0*2 6 + 1*2 5 + 0*2 4 + 1*2 3 + 0*2 2 + 0*2 1 + 0*2 0 128 [10] + 0 + 32 [10] + 0 + 8 [10] + 0 + 0 + 0 Sum: 168 [10]

13 13 Hexadecimal (Hex) Number System Digits: 0..9, A, B, C, D, E, F Base: Sixteen Each position is power of 16 Example: A8 [16] A * 16 1 = 160 [10] 8 * 16 0 =8 [10] Sum:168 [10]

14 14 Notation for Number Systems Subscript used to denote base 25[10]decimal 19[16]hexadecimal 0001 1001[2]binary Web pages and some programming languages Decimal: no additional symbols Hexadecimal: use pound sign “#” Other notation conventions Hexadecimal: “h” or 0x Octal: “o” Binary: “b”

15 15 Binary to Hexadecimal Conversion The easiest method for converting binary to hexadecimal is to use a substitution code Each hex digit converts to 4 binary digits

16 16 Conversion to Hexadecimal Binary to hex: Convert each nibble to hex digit (see previous slide) Decimal to hex: Use repeated division by powers of 16 to find hex digit at each position 16 3 = 4096, 16 2 = 256, 16 1 = 16, 16 0 = 1 1946 [10] to hex: (1946\256 = 7) + (154\16 = 9) + (10\1) = A Sum: 79A (7*256=1792) + (9*16=144) + (10*1=10) = 1946 Or… Windows Calculator

17 17 Bits, Bytes, and Nibbles Computers use 0 and 1 states to represent data and instructions Each stored state or pathway to transport a state is a bit Eight bits are a byte Basic grouping of bits in computers Can be represented by two hex digits Values: 00..FF or 0..255 Half of byte is nibble (nybble) Can be represented by one hex digit Values: 0..F or 0..15

18 18 Binary Integer Addition Binary has only two digits: 0, 1 Addition rules: 0 + 0 = 01 + 0 = 1 0 + 1 = 11 + 1 = 10 Examples: 3 + 3 = 0011 + 0011 = 0110 5 + 7 = 0101 + 0111 = 1100 9 + 7 = 1001 + 0111 = 10000 – Overflow

19 19 Binary Integer Subtraction Two digits: 0, 1 Number of bits dependent Rules for two bits and A≥B 00–00 = 00; 01–00 = 01; 01–01 = 00; 10–00 = 10; 10–01 = 01; 10–10 = 00; 11–00 = 11; 11–01 = 10; 11–10 = 01; 11–11 = 00 A<B governed by signed representation used

20 20 Two’s Complement Rule for storing signed integers Results in “clock” of numbers Rule for negating a number Take complement of number Value 6 [10] =0110 [2] Complement 1001 Add one1 Yields 2’s complement1010 “Clock” values dependent on number of bits 4 bits: -8.. 7 8 bits: -128.. 127 32 bits: -2,147,483,648.. 2,147,483,647 64 bits: -9,223,372,036,854,775,808.. 9,223,372,036,854,775,807 0 1 2 3 5 6 4 -8 7 -2 -3 -4 -5 -6 -7 0 1 2 3 5 6 4 8 7 15 14 13 12 11 10 9

21 21 Overflow and Underflow Overflow caused by operation generating number greater than register can hold 0111 + 0001 = 1000 7 + 1 ≠ -8 Underflow caused by operation generating number less than register can hold 1000 – 0001 = 0111 -8 – 1 ≠ 7 Either will cause returned value to wrap around “clock”

22 22 Example Colors on web pages are often expressed in hex “#00FF80” Graphics editors often represent the color components in decimal values Red: 0 Green: 255 Blue: 128 Graphics editors may represent the color components as percentages Red: 0 Green: 100 Blue: 50 To blend a graphic into the background of a web page, the correct hex value must be calculated

23 23 Conclusion Questions?


Download ppt "The Hexadecimal Number System and Memory Addressing ISAT 121."

Similar presentations


Ads by Google