Download presentation
Presentation is loading. Please wait.
Published byΔωρόθεος Πρωτονοτάριος Modified over 5 years ago
1
UNIT – 3 & 4. Data Representation and Internal
UNIT – 3 & 4 Data Representation and Internal Operations of the Computer (Logic gates)
2
Abacus Abacus is a Latin word, related to the Greek “abax”, meaning table. The word `calculus’ originally meant pebble in Latin, used on the counting board. Roman Abacus The Chinese Abacus appeared around 1100AD, it was introduced to Japan around 1500 AD. Chinese Abacus JapaneseSoroban (Abacus)
3
2.1 – Introduction to the Number System
A number system defines a set of symbols used to represent quantity. Quantifying values and items in relation to each other is helpful to us to make sense of our environment. The study of number system is not just limited to computers. We use numbers every day. A computer manipulates and stores numbers inside the computer system.
4
To represent these states we have to use number systems.
Why we learn it? These symbols are processed internally by components that can maintain a limited number of discrete states. To represent these states we have to use number systems. Ex: The decimal digits 0,1,2, …..,9 provide 10 discrete symbols (10 digits)
5
Decimal Number system – Place Values
We normally use the decimal number system 342 Hundreds Tens Ones 3 x 100 4 x 10 2 x 1
6
343 Hundreds Tens Ones 3 x 100 4 x 10 3 x 1
7
344 Hundreds Tens Ones 3 x 100 4 x 10 4 x 1
8
345 Hundreds Tens Ones 3 x 100 4 x 10 5 x 1
9
346 Hundreds Tens Ones 3 x 100 4 x 10 6 x 1
10
347 Hundreds Tens Ones 3 x 100 4 x 10 7 x 1
11
348 Hundreds Tens Ones 3 x 100 4 x 10 8 x 1
12
349 Hundreds Tens Ones 3 x 100 4 x 10 9 x 1
13
350 Hundreds Tens Ones 3 x 100 5 x 10 0 x 1
14
Consider this number format 53410
The Base of the Decimal number here is 10 Normally we don’t write base numbers in decimal form We can use digits 0 - 9
15
Face Value and Place value
Weighing Factor The weighing factor is the multiplier value applied to each column position of the number. For instance, a decimal has a weighing factor of TEN, in that each column on the immediate left indicates an increase in value by a multiple of 10. i.e.; each column moves to the left increasing by a multiple of 10. 312 = = 3 * * * 1 = 3 * * * 100 Weighing factors
16
Decimal Number System(cont..)
The decimal Number System: uses base 10 includes only the symbols 0 through 9 The weighed values for each position is as follows: 104 103 102 101 100 10-1 10-2 10-3 10000 1000 10 1 .1 .01 .001
17
Decimal number system (cont..)
This number system uses TEN different symbols to represent values. The set values used in decimal are Least value Highest value When doing a calculation, if the highest digit (9) is exceeded, a carry over transferred to the next column (to the left) occurs. Lets 17 18 +1 19 +2 20 +3 21 +4 When 9 is exceeded, we reset (0), and carry a value of 1 to the next column on the left
18
Binary number system TWO symbols are used to represent numerals in the binary number system. These have the values of, 1 0 represents low value, and 1 represents high value. Position x ……………….. 5 4 3 2 1 Binary Value ……………… Decimal Value 2 x-1 ………………. 24 23 22 21 20
19
More illustration….. The binary number system is also known as the base 2 number system. The values of the positions are calculated by raising 2 to some power. Why is 2 the base in binary numbers? Because we use 2 digits, the digits 0 and 1.
20
Binary Number System (con’t)
The binary number system is also a positional numbering system. Instead of using ten digits, 0 - 9, the binary system uses only two digits, 0 and 1. Example of a binary number and the position values :
21
Representation of the binary number 0101
4 1 1 x 22 0 x 21 1 x 20 0 x 23 Position x 4 3 2 1 Binary Value Decimal Value 2 x-1 23 22 21 20
22
Binary Number System(cont…)
uses base 2 includes only the digits 0 and 1 The weighted values for each position is as follows: 27 26 25 24 23 22 21 20 128 64 32 16 8 4 2 1
23
Octal number system The octal number system uses EIGHT symbols to represent numbers. The 8 distinct symbols are, With 0 having the lowest value and 7 are having the highest value Columns are used in the same way as in the decimal system in that, the left most column is used to represent the greatest value Octal numbers are represented with the base 8
24
Representation of octal number 314
64 1 64 1 64 8 1 0 x 83 3 x 82 1 x 81 4 x 80
25
Octal Number System The Octal system is based on the binary system with a 3-bit boundary. The Octal Number System: uses base 8 includes only the symbols 0 through 7 The weighted values for each position is as follows: 85 84 83 82 81 80 32768 4096 512 64 8 1
26
Hexadecimal number system
The hexadecimal number system uses SIXTEEN symbols to represent Numbers. The 16 distinct symbols are, A B C D E F, where A = 10, B = 11, .., F = 15 With ‘0’ having the lowest value and ‘F’ having the highest value. Hexadecimal numbers are represented with the base 16.
27
Representation of hexadecimal number 34F
1 1 1 1 1 1 1 1 1 1 16 1 16 256 1 16 1 256 1 256 16 1 0 x 163 1 x 162 4 x 161 F(15) x 160
28
The Hexadecimal Number System: uses base 16
includes only the symbols 0 through 9 and the letters A, B, C, D, E, and F to represent 10, 11, 12, 13, 14, and 15 respectively. The weighted values for each position is as follows: 163 162 161 160 4096 256 16 1
29
2.1.2 Number Base Conversion
Binary to Decimal Multiply each digit by its weighted position, and add each of the weighted values. Example The binary value 1011 represents: 1x23 + 0x22 + 1x21 + 1x20 =1x8 + 0x4 + 1x2 + 1x1 = =11 (base 10)
30
Binary to Octal Conversion
It is easy to convert a binary number to an octal. This is accomplished by: Most Significant Bit (MSB) Least Significant Bit (LSB) 1. Break the binary number into 3-bit sections from the LSB to the MSB. 2. Convert the 3-bit binary number to its octal equivalent. For example, the binary value will be written: 001 010 111 110 1 2 7 6
31
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0
32
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1
33
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1
34
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1
35
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1 15 / 2 gives with remainder 1
36
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1 15 / 2 gives with remainder 1 7 / 2 gives with remainder 1
37
Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1 15 / 2 gives with remainder 1 7 / 2 gives with remainder 1 3 / 2 gives with remainder 1
38
111111102 Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1 15 / 2 gives with remainder 1 7 / 2 gives with remainder 1 3 / 2 gives with remainder 1 1 / 2 gives with remainder 1
39
111111102 Lets find the binary equivalent of the decimal number 254
254 / 2 gives 127 with remainder 0 LSB 127 / gives 63 with remainder 1 63 / 2 gives 31 with remainder 1 31 / 2 gives 15 with remainder 1 15 / 2 gives with remainder 1 7 / 2 gives with remainder 1 3 / 2 gives with remainder 1 1 / 2 gives with remainder 1 MSB
40
Converting from Binary to Decimal
1 X 20 = 1 0 X 21 = 0 1 X 22 = 4 1 X 23 = 8 0 X 24 = 0 0 X 25 = 0 1 X 26 = 20 = = = = = = = 8
41
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1
42
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1 23 / 2 11
43
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1 23 / 2 11 11 / 2 5 111
44
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1 23 / 2 11 11 / 2 5 111 5 / 2 2 1111
45
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1 23 / 2 11 11 / 2 5 111 5 / 2 2 1111 2 / 2 01111
46
Decimal to Binary (Repeated Division By 2)
Quotient Remainder Binary Number 47 / 2 23 1 23 / 2 11 11 / 2 5 111 5 / 2 2 1111 2 / 2 01111 1 / 2 101111 4710 =
47
Conversion from Binary to Octal
Convert to octal. Each octal digit is represented by 3 binary bits. Split the binary number into groups of 3 bits, starting from the right. = 2 = 6 = 7 = 2678
48
Conversion from binary to hexadecimal
Convert to hexadecimal. Each hexadecimal digit represents 4 binary bits. Split the binary number into groups of 4 bits, starting from the right. 1 0110 =1 =6 =16 in hexadecimal
49
Binary Addition 1101 101+ 10010 1 0+1 0+0 1+0 0 and Carry 1 1+1 Result
0+0 1+0 0 and Carry 1 1+1 Result Operation 10010 1 1101 101+
50
Conversion from hexadecimal to decimal
Convert hexadecimal to decimal. Each column represents a power of 16, 17616= (1 * 162) + (7 * 161) + (6 * 160) = (1 * 256) + (7 * 16 )+ (6 * 1) = = 374
51
Conversion from Octal to Decimal
Convert 1768 to decimal. Each column represents a power of 8, 176 = 1 * * * 80 = (1 * 64) + (7 * 8) + (6 * 1) = = 126
52
Please complete the activities from page 80 to 91
53
Relationship between binary and octal
Binary (in 3 bits) 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111
54
Octal to Decimal Conversion
To convert from Octal to Decimal, multiply the value in each position by its Octal weight and add each value. Example, convert this octal 342 to decimal, we can obtain the decimal value as follows: 3x82 4x81 2x80 3x64 4x8 2x1 192 32 2 = 226 8 64 8 64 8 1 64 8 1 3 x 82 4 x 81 2 x 80
55
Decimal to Octal Conversion
To convert decimal to octal is slightly more difficult. The typical method to convert from decimal to octal is repeated division by 8. Repeated Division By 8 For this method, divide the decimal number by 8, and write the remainder on the side as the least significant digit. This process is continued by dividing the quotient by 8 and writing the remainder until the quotient is 0.
56
Decimal to Octal Conversion
To convert decimal to octal is slightly more difficult. The typical method to convert from decimal to octal is repeated division by 8. Repeated Division By 8 For this method, divide the decimal number by 8, and write the remainder on the side as the least significant digit. This process is continued by dividing the quotient by 8 and writing the remainder until the quotient is 0. Division Quotient Remainder 87 / 8 10 7
57
Decimal to Octal Conversion
To convert decimal to octal is slightly more difficult. The typical method to convert from decimal to octal is repeated division by 8. Repeated Division By 8 For this method, divide the decimal number by 8, and write the remainder on the side as the least significant digit. This process is continued by dividing the quotient by 8 and writing the remainder until the quotient is 0. Division Quotient Remainder 87 / 8 10 7 10 / 8 1 2
58
Decimal to Octal Conversion
To convert decimal to octal is slightly more difficult. The typical method to convert from decimal to octal is repeated division by 8. Repeated Division By 8 For this method, divide the decimal number by 8, and write the remainder on the side as the least significant digit. This process is continued by dividing the quotient by 8 and writing the remainder until the quotient is 0. Division Quotient Remainder 87 / 8 10 7 10 / 8 1 2 1 / 8 8710 = 1278
59
Binary to Hex Conversion
It is easy to convert a binary number to hex. This is accomplished by: 1.Break the binary number into 4-bit sections from the LSB to the MSB. 2.Convert the 4-bit binary number to its Hex equivalent. For example, the binary value is written: 1010 1111 1011 0010 A F B 2
60
Relationship between Binary and Hexadecimal
Binary (in 4 bits) 0000 8 1000 1 0001 9 1001 2 0010 A 1010 3 0011 B 1011 4 0100 C 1100 5 0101 D 1101 6 0110 E 1110 7 0111 F 1111
61
Hex to Binary Conversion
It is also easy to convert from an integer hex number to binary. This is accomplished by: Convert the Hex number to its 4-bit binary equivalent. Combine the 4-bit sections by removing the spaces. For example the hex value B2 is written in binary: B 2 1011 0010 This yields the binary number or in our more readable format.
62
Hex to Decimal Conversion
To convert from Hex to Decimal, multiply the value in each position by its hex weight and add each value. Using the value from the previous example, B216, we can obtain the decimal value as follows: 16 16 B x 161 2 x 160 11 x 16 2 x 1 176 2 16 16 16 16 16 16 1 16 = 178 16 1 16 0 x 163 3 x 162 4 x 161 2 x 160
63
Decimal to Hex Conversion
To convert decimal to hex is slightly more difficult. The typical method to convert from decimal to hex is repeated division by 16. Repeated Division By 16 For this method, divide the decimal number by 16, and write the remainder on the right hand side as the least significant digit. This process is continued by dividing the quotient by 16 and writing the remainder until the quotient is 0.
64
Ex: Convert decimal 2811 to hex as follows:
Division Quotient Remainder 2811 / 16 175 11 = B
65
Ex: Convert decimal 2811 to hex as follows:
Division Quotient Remainder 2811 / 16 175 11 = B 175 / 16 10 15 = F
66
Ex: Convert decimal 2811 to hex as follows:
Division Quotient Remainder 2811 / 16 175 11 = B 175 / 16 10 15 = F 10 / 16 10 = A
67
Ex: Convert decimal 2811 to hex as follows:
Division Quotient Remainder 2811 / 16 175 11 = B 175 / 16 10 15 = F 10 / 16 10 = A = AFB16
68
What is BIT (BINARY DIGIT)?
2.2 Data Representation What is BIT (BINARY DIGIT)? A bit is the smallest element of information used in a computer A bit holds ONE of TWO possible values, A bit which is OFF is also considered to be FALSE or NOT SET; a bit which is ON is also considered to be TRUE or SET Only one of two values(0 or 1) can be stored in a single bit.
69
With a single bit, you can represent any two distinct items.
Examples one or zero true or false on or off male or female right or wrong
70
Data Representation H ASCII CODE IS 72 H
71
What is Byte ? Bytes are a grouping of 8 bits
A byte is the smallest addressable datum (data item) in the memory by the microprocessor.
72
The bits in a byte are filled from LSB (b0) to MSB (b7) respectively as follows:
1 b7 b6 b5 b4 b3 b2 b1 b0 Most Significant Bit (MSB) Least Significant Bit (LSB) The Binary equivalent of the decimal number 205 is as follows and the Most Significant Bit(MSB) and the Least Significant Bit (LSB)can be defined as below : 1 MSB LSB
73
Since a byte consists of eight bits, it can represent 28, or 256,
different values. Generally, we use a byte to represent: Unsigned numeric values in the range 0 to 255 Signed numbers in the range -128 to +127 ASCII(American Standard Code for Information Interchange) character codes Other special data types requiring no more than 256 different values. Many data types have fewer than 256 items so eight bits is usually adequate.
74
Capacity of Various Units
8 bits = 1Byte (2 10) Byte = 1 KB (kilobyte) (210) KB = 1 MB (Megabyte) (210) MB = 1 GB (Gigabyte) (210 ) GB = 1 TB (Terabyte) Unit conversion 1kiloByte = 210 bytes 1MegaByte= 220 bytes 1GigaByte = 230 bytes 1TeraByte = 240 bytes
75
2.2.2 Coding Systems BCD (Binary Coded Decimal) ASCII
(American Standard Code for Information Interchange)
76
BCD - Binary Corded Decimal
Binary Coded Decimal is a numerical code. In this code structure, each of the decimal digits (0-9) is represented by a four-bit binary code (eg: 3 is represented by 0011) Each digit is then represented by it's binary equivalent. 16 unique(different) numbers can be stored in the 4 bit binary code. Thus there are 6 invalid four-bit combinations in the BCD code.
77
The number 59 is coded in BCD as follows 5 9
0101 1001 BCD code is The number 386 is coded in BCD as follows: 3 8 6 0011 1000 0110 BCD code is This makes BCD easy to read, but it is not very efficient in terms of storage space, nor is it as efficiently processed in hardware.
78
Cont… BCD Valid Combinations Invalid Combinations Decimal BCD 10 1010
0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Decimal BCD 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111
79
Cont ….BCD Converting the Decimal value 546 to BCD 5 = 0101 4 = 0100
6 = 0110 Thus = Converting the binary value to decimal is 0111 = 7 0001 = 1 0101 = 5 Thus = 71510
80
ASCII - The American Standard Code for Information Interchange
The American National Standards Institute has published an American Standards Code for Information Interchange(ASCII) This code is now most widely used by major manufactures. so that their equipment will be compatible with those of other manufactures.
81
ASCII is a computer code which uses 128 different coding combinations of a group of seven bits (27= 128) to represent Characters A to Z, both upper and lower case Special characters, < , ., ?, : ,etc., Numbers 0 to 9 Special control codes used in device control
82
The tables below gives the ASCII character set :-
HEX DEC CHAR 41 65 A 42 66 B 43 67 C 44 68 D - 58 88 X 59 89 Y 5A 90 Z HEX DEC CHAR 61 97 a 62 98 b 63 99 c 64 100 d - 78 120 x 79 121 y 7A 122 z HEX DEC CHAR 30 48 31 49 1 32 50 2 33 51 3 34 52 4 35 53 5 36 54 6 37 55 7 38 56 8 39 57 9
83
ASCII (Cont……) Example Code the text string 'Hello.' in ASCII using hexadecimal digits. H = 48 e = 65 l = 6C o = 6F . = 2E Thus the string is represented by the byte sequence C 6C 6F 2E
88
2.3 Logic Gates and Circuits
Where are we?
89
What is logic gate? A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs and one output. At any given moment, every terminal is in one of the two binary conditions low (0) or high (1), represented by different voltage levels. In most logic gates, the low state is approximately zero volts (0 V), while the high state is approximately five volts positive (+5 V). There are seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR.
90
Logic gates are small (several micron) structures which take one or more bits as input, and produce another bit as output Different logic gates use different techniques to calculate their output
91
The most common logic gates used perform the following logic functions:
AND : Output is True(1) if all inputs are True (1) OR : Output is False (0) if all inputs are False (0) NOT : Output is the opposite of the single input i.e., If input is true (1) the output is false (0) If input is false (0) the output is true (1)
92
AND - Gate The AND gate has two or more inputs.
The output from the AND gate is 1 if and only if all of the inputs are 1, otherwise the output from the gate is 0. The AND gate is drawn as follows + - A B A.B F=A.B A B
96
1
97
1
99
1
100
1
102
1 1
103
1 1 1
104
1
105
Truth table for AND gate A B A.B
F=0 1 F=1 A B A.B 1 The output from the AND gate is written as A.B The truth table for a two-input AND gate looks like
106
OR-Gate The OR gate has two or more inputs.
The output from the OR gate is 1 if any of the inputs is 1. The gate output is 0 if and only if all inputs are 0. The OR gate is drawn as follows A + - B A+B A B F=A+B
111
1
112
1
113
1
114
1
115
1
116
1
117
1
118
1
119
1
120
1 1
121
1
122
1
123
Truth table for OR gate A B A+B 1
F=0 1 F=1 A B A+B 1 1 F=1 1 F=1 The output from the OR gate is written as A+B The truth table for a two-input OR gate looks like
124
NOT-Gate The NOT gate is unique in that it only has one input. It looks like A Ā 1 A Ā The input to the NOT gate A is inverted i.e. The binary input state of 0 gives an output of 1 and the binary input state of 1 gives an output of 0. Ā is known as "NOT A" or alternatively as the complement of A.
125
Logic Gates from Transistors
For example, we will build a NOT gate from a transistor. extra power source Transistor Output from NOT gate. Input to NOT gate.
126
Logic Gates from Transistors
For example, we will build a NOT gate from a transistor. extra power source Transistor OFF Output from NOT gate is OFF. Input to NOT gate is ON. NOT 1 0
127
Logic Gates from Transistors
For example, we will build a NOT gate from a transistor. extra power source Transistor ON Output from NOT gate is ON. Input to NOT gate is OFF. NOT 0 1
129
1
130
1
133
NAND-Gate 1 A B The truth table for a two-input NAND gate looks like A
1
134
NOR-Gate 1 A B The truth table for a two-input NOR gate looks like A B
1
135
XOR-Gate A B P 1 The truth table for a two-input XOR gate looks like A
1
136
Please complete the activities in page 121 to 122
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.