Download presentation
Presentation is loading. Please wait.
Published byRafe Lindsey Modified over 9 years ago
1
EX_01.1/46 Numeric Systems
2
EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
3
EX_01.3/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
4
EX_01.4/46 Numeric systems – General … A numeric system consists of an ordered set of symbols, called digits, with relations defined for addition, subtraction, multiplication, and division, † < ¿ < Ä < ¤ < Æ < § < ₣ < ‡ < † < ® Example: §Ä‡ †® + Æ® †® = §‡‡ †®, The problem is that we use in different systems the very same symbols, The base, of a number system, is the total number of digits allowed in the number system.
5
EX_01.5/46 Numeric systems – General (Cont’d) … The most common number systems used in digital system design and computer programming are binary, decimal, hexadecimal and octal, Computer’s information is coded in the shape of on or off bits; (1 and 0), this way of codifying takes us to the necessity of knowing the positional calculation which will allow us to express a number in any base where we need it.
6
EX_01.6/46 Numeric systems – General (Cont’d) … It is possible to represent a determined number in any base through the following formula: Where: n is the position of the digit beginning from right (position 0) to left and numbering from zero. D is the digit on which we operate and B is the used numeric base.
7
EX_01.7/46 Numeric systems – General (Cont’d) Example of Positional Number System: 1734 10 = 1*10 3 + 7*100 2 + 3*10 1 + 4*1 0, = 1*1000 + 7*100 + 3*10 + 4*1, Here 10 is the base, or radix, of the number system, The value of the number is the sum of each digit multiplied by the corresponding power of the radix.
8
EX_01.8/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
9
EX_01.9/46 Binary Numbers … Digital systems are usually constructed using two- state devices that are either in an off state or an on state, Therefore, the binary number system is perfect for representing numbers in digital systems (since only two digits, 0 and 1, are needed), A single bit can be stored in a two-state storage device often called a latch, Binary numbers of length n can be stored in an n-bit long device known as a register.
10
EX_01.10/46 Binary Numbers (Cont’d) … The digits: {0, 1} Examples: 1100111 2, 1010101111 2, 0 2, 11 2, 110110110110011 2 (28,083 10 ) MSB – Most Significant Bit, LSB – Least Significant Bit, MSB LSB
11
EX_01.11/46 Binary Numbers (Cont’d) … Binary to Decimal Conversion Method: Summation: Σ, Convert 10011 2 (Binary) to Base 10, … (Decimal): 1*2 0 + 1*2 1 + 0*2 2 + 0*2 3 + 1*2 4 (Decimal): 1*1 + 1*2 + 0*4 + 1*8 + 1*16 = 19 10.
12
EX_01.12/46 Binary Numbers (Cont’d) … Another Example: Convert 10111011001 2 (Binary) to Base 10, … (Decimal): 1*2 0 + 0*2 1 + 0*2 2 +1*23 + 1*2 4 + 0*2 5 + 1*2 6 + 1*2 7 + 1*2 8 + 0*2 9 + 1*2 10 = (Decimal): 1*1 + 0*2 + 0*4 + 1*8 + 1*16 + 0*32 + 1*64 + 1*128 + 1*256 + 0*512 + 1*1024 = 1497 10.
13
EX_01.13/46 Binary Numbers (Cont’d) … Decimal to Binary Conversion Method: Use the successive division of two, keeping the residue as a binary digit and the result as the next number to divide. Let us take for example the decimal number of 43 10. 43/2 = 21 and its residue is 1 (LSB), 21/2 = 10 and its residue is 1, 10/2 = 5 and its residue is 0, 5/2 = 2 and its residue is 1, 2/2 = 1 and its residue is 0, 1/2 = 0 and its residue is 1 (MSB), The binary result is 101011 2.
14
EX_01.14/46 Binary Numbers (Cont’d) … Decimal to Binary Conversion Method: Division Convert 108 10 (Decimal) to Base 2 (Binary): … 108/2 = 54 and remainder 0 (LSB), 54/2 = 27 and remainder 0, 27/2 = 13 and remainder 1, 13/2 = 6 and remainder 1, 6/2 = 3 and remainder 0, 3/2 = 1 and remainder 1, 1/2 = 0 and remainder 1 (MSB), Result: 1101100 2.
15
EX_01.15/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
16
EX_01.16/46 Octal Numbers … The digits: {0, 1, 2, 3, 4, 5, 6, 7}, Examples: 1254 8, 25774 8, 3307122 8, Octal to Decimal Conversion Method: Summation Σ, Convert 1234 8 (Octal) to Base 10 (Decimal): … 4*8 0 + 3*8 1 + 2*8 2 + 1*8 3 + = 4*1 + 3*8 + 2*64 + 1*512 = 668 10.
17
EX_01.17/46 Octal Numbers … (Cont’d) Decimal to Octal Conversion Method: Division, Convert 108 10 (Decimal) to Base 8 (Octal): … 108/8 = 13 and remainder 4 (LSB), 13/8 = 1 and remainder 5, 1/8 = 0 and remainder 1 (MSB), Result: 154 8.
18
EX_01.18/46 Octal Numbers … (Cont’d) Octal to Binary Conversion Method: Substitution, Substitute any octal digit with three binary digits. 0 8 = 000 2 1 8 = 001 2 2 8 = 010 2 3 8 = 011 2 4 8 = 100 2 5 8 = 101 2 6 8 = 110 2 7 8 = 111 2, Convert 1234 8 (Octal) to Base 2 (Binary): … 001 010 011 100 2, 1010 011100 2.
19
EX_01.19/46 Octal Numbers (Cont’d) Binary to Octal Conversion Method: Substitution, Convert 10111011001 2 (Binary) to Base 8 (Octal): … 10 111 011 001 2, 010 111 011 001 2, Result: 2731 8.
20
EX_01.20/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
21
EX_01.21/46 Hexadecimal Numbers … The digits: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}, On the hexadecimal base we have 16 digits which go from 0 to 9 and from the letter A to the F, these letters represent the numbers from 10 to 15. Thus we count 0 16, 1 16, 2 16, 3 16, 4 16, 5 16, 6 16, 7 16, 8 16, 9 16, A 16, B 16, C 16, D 16, E 16, F 16 and 10 16, Examples: 890A 16, CC02FFE 16, 12B 16, B12 16, 0 16, 12 16, A2 16, 3FF0E7071A9 16.
22
EX_01.22/46 Hexadecimal Numbers (Cont’d) … DecBinaryOctHex 00 000000 0 10 000101 1 20 001002 2 30 001103 3 40 010004 4 50 010105 5 60 011006 6 70 011107 7 DecBinaryOctHex 80 100010 8 90 100111 9 100 101012 A 110 101113 B 120 110014 C 130 110115 D 140 111016 E 150 111117 F 161 00002010
23
EX_01.23/46 Hexadecimal Numbers (Cont’d) … Hexadecimal to Decimal Conversion Method: Summation Σ, Convert C0DE 16 (HEX) to Base 10 … (Decimal) 14*16 0 + 13*16 1 + 0*16 2 + 12*16 3 = (Decimal): 14*1 + 13*16 + 0*256 + 12*4096 = 49374 10.
24
EX_01.24/46 Hexadecimal Numbers (Cont’d) … Decimal to Hexadecimal Conversion Method: Division, Convert 108 10 (Decimal) to Base 16 (HEX): … 108/16 = 6 and remainder 12 (which is C 16 ) (LSB) 6/16 = 0 and remainder 6 (MSB) Result: 6C 16.
25
EX_01.25/46 Hexadecimal Numbers (Cont’d) … Hexadecimal to Binary Conversion Method: Substitution, Convert FFCE755 16 (Hex) to Binary16, … 7FCEE55 16 = 0111 1111 1100 1110 1110 0101 0101 2 = 111111111001110111001010101 2.
26
EX_01.26/46 Hexadecimal Numbers … (Cont’d) Binary to Hexadecimal Conversion Method: Substitution, Convert 10111011001 2 (Binary) to Base 16, … 10111011001 2 = 101 1101 1001 0101 1101 1001 2 = 5D9 16.
27
EX_01.27/46 Hexadecimal Numbers (Cont’d) … Hexadecimal to Octal Conversion Method: Substitution (via binary), Convert C0DE 16 (HEX) to Base 8, … C0DE 16 = 1100 0000 1101 1110 2 1100 0000 1101 1110 2 = 001 100 000 011 011 110 2 001 100 000 011 011 110 2 = 140336 8, Added leading 0s
28
EX_01.28/46 Conversion Methods Diagram 10 16 8 2 Division / 16 Substitution Division / 8 Substitution Division / 2
29
EX_01.29/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
30
EX_01.30/46 Data Units … In the computer memory we locate our data. The data may be: Bit wide (that is 1 or 0), 0 2 in a bit we can hold either 0 2 or 1 2, Nibble - 4 bits wide, 0000 2 in a nibble we can hold numbers from 0 2 to 1111 2 that is from 0 to 15 10, Byte is 8 bits wide, 0000 0000 2 0 – 11111111 2, that is 0 to 255 10.
31
EX_01.31/46 Data Units (Cont’d) Word is 16 bits wide, 0000 0000 0000 0000 2 0 – 1111 1111 1111 1111 2 that is 0 – 65,535 10, Double Word is 32 bits wide 0000 0000 0000 0000 0000 0000 0000 0000 2 0 – 1111 1111 1111 1111 1111 1111 1111 1111 2 that is 0 – 4,294,967,295 10, Notice: all these are positive numbers, we haven’t touch yet any negative number.
32
EX_01.32/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
33
EX_01.33/46 ASCII Code … ASCII is an acronym of American Standard Code for Information Interchange, This code assigns the letters of the alphabet, decimal digits from 0 to 9 and some additional symbols a binary number of 7 bits, putting the 8th bit in its off state or 0, For example: Space has the ASCII code of 30 16, that is 0011 0000 2, ‘A’ has the ASCII code of 41 16, that is 0110 0001 2, ‘0’ has the ASCII code of 30 16, that is 0011 0000 2.
34
EX_01.34/46 ASCII Code (Cont’d) … This way each letter, digit or special character occupies one byte in the computer memory, ASCII is very inefficient on the numeric aspect, since in binary format one byte is enough to represent numbers from 0 to 255, but on the other hand with the ASCII code one byte may represent only one digit. Due to this inefficiency, the ASCII code is mainly used in the memory to represent text.
35
EX_01.35/46 ASCII Code (Cont’d) …
36
EX_01.36/46 ASCII Code (Cont’d) …
37
EX_01.37/46 ASCII Code (Cont’d) Translate the following: 48656C6C6F20576F726C6421 16, … Hello World!
38
EX_01.38/46 Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
39
EX_01.39/46 Negative number’s representation … So far we have seen only positive (and 0) numbers, How can we represent negative numbers in computers?
40
EX_01.40/46 Neg. Num: 2’s complement The 2’complemet method: In this method the first bit is the sign…, but serves as part of the number as well.
41
EX_01.41/46 The 2’complement Notation (Cont’d) … In order to achieve the 2’complemet representation of a number, do the following: A. Invert all the digits, that is 0 ->1, and 1-> 0. Example: 01001110 2 ->10110001 2 (1’complemet), B. Add 1 to the result. Example 10110001 2 + 1 2 = 10110010 2, That is 10110010 2 is the 2’complemet of 01001110 2.
42
EX_01.42/46 The 2’complement Notation (Cont’d) … Compute 00101101 2 – 00001100 2 (45 10 – 12 10 ), We will do this by adding 00001100 2 2’complement! Lets change 00001100 2 to its 2’complement, A. 00001100 -> 11110011 2 (1’complemet), B. 11110011 2 + 1 = 11110100 2 (2’complemet), Now let us sum these two numbers: 00101101 2 + 11110100 2 1:00100001 2, that is 33 10 Carry
43
EX_01.43/46 The 2’complement Notation (Cont’d) … What is the 2’complemet of a 2’complemet? Example: 00110101 2 (53 10 ) First 2’complemet: A. 00110101 2 -> 11001010 2 (1’complemet), B. 11001010 2 + 1 = 11001011 2 (2’complemet), Second 2’complement: A. 11001011 2 -> 00110100 2 (1’complemet), 00110100 2 + 1 = 00110101 2 (2’complemet),
44
EX_01.44/46 The 2’complement Notation (Cont’d) With n bits you can represent the numbers from –2 n-1 to +2 n-1 -1, -1 is a string of 1s, Zero is a string of 0s, (what is his 2’complemet?), –2 n is 1 and the rest 0s, +2 n is invalid, unless you move to a larger register (i.e. a representation of a larger size).
45
EX_01.45/46 Summary Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code, Negative number’s representation.
46
EX_01.46/46 Numeric Systems The End.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.