Download presentation
Presentation is loading. Please wait.
Published byRosalind Kelly Modified over 9 years ago
1
1 Lect # 1 Binary Systems Digital vs. Analog Analog – a continuous range of values Digital – a discrete set of values –Like money –Can’t get smaller than cents –Typically also has maximum value
2
2 Benefits of using digital Cheap electronic circuits Easier to calibrate and adjust Resistance to noise: Clearer picture and sound Analog signal Digital signal
3
3 DIGITAL SYSTEMS discrete information processing system discrete information processing system Discrete elements of info. are represented in a digital system by physical quantities called signals. Discrete elements of info. are represented in a digital system by physical quantities called signals. Electrical signals such as voltages and currents are the most common. Electrical signals such as voltages and currents are the most common. Digital systems that are constrained to take discrete values are further constrained to take binary values. Digital systems that are constrained to take discrete values are further constrained to take binary values.
4
4 Control Unit Processor or Arithmetic Unit Storage or Memory Unit Input Devices and Control Output Devices and Control Block Diagram of a Digital Computer DIGITAL SYSTEMS
5
5 The memory unit stores programs as well as input, output, and intermediate data. The processor unit performs arithmetic and other data- processing tasks as specified by a program. The control unit supervises the flow of information between the various units. It retrieves the instructions 1 by 1, from the program which is stored in memory. For each instruction, it informs the processor to execute the operation specified by the instruction. Both program and data are stored in memory. The control unit supervises the program instructions, and the processor manipulates the data as specified by the program. The program and data prepared by the user are transferred into the memory unit by means of an input device. An output device receives the result of the computations and the printed results are presented to the user. The input and output devices are special digital systems driven by electromechanical parts and controlled by electronic digital circuits.
6
6 DIGITAL SYSTEMS An electronic calculator is a digital system similar to a digital computer, why? ANS. The input device being a keyboard; the output device a numerical display; *Instructions are entered by means of the function keys such as + and -; Results are displayed directly in numeric form A digital computer, however, is a more powerful device than a calculator, how? ANS. A digital computer can accommodate many other input and output devices; it can perform not only arithmetic computations but logical operations as well
7
7 it can be programmed to make decisions based on internal and external conditions A processor when combined with the control unit, forms a component referred to as a central processing unit or CPU A CPU enclosed in a small IC package is called a microprocessor A CPU combined with memory and interface control to form a small-size computer is called a microcomputer
8
8 Discrete elements of information are represented with bits called binary codes. Example: (09) 10 = (1001) 2 (15) 10 = (1111) 2 Question: Why are commercial products made with digital circuits as opposed to analog? Most digital devices are programmable: By changing the program in the device, the same underlying hardware can be used for many different applications. Binary System
9
9 Review the decimal number system. Base (Radix) is 10 - symbols (0,1,.. 9) Digits For Numbers > 9, add more significant digits in position to the left, e.g. 19>9. Each position carries a weight. Weights: MSD LSD If we were to write 1936.25 using a power series expansion and base 10 arithmetic: 4 Binary Code
10
10 4 The octal number system [from Greek: . –Its base is 8 eight digits 0, 1, 2, 3, 4, 5, 6, 7 4 The hexadecimal number system. –Its base is 16 first 10 digits are borrowed from the decimal system and the letters A, B, C, D, E, F are used for the digits 10, 11, 12, 13, 14, 15 (236.4) 8 = (158.5) 10 (D63FA) 16 = (877562) 10 Octal/Hex number systems
11
11 Find the binary equivalent of 37. MSB LSB ANS: ? = 18 + 0.5 = 9 + 0 = 4 + 0.5 = 2 + 0 = 1 + 0 = 0 + 0.5 1 0 1 0 0 1 Conversion from Decimal to Binary
12
12 Conversion from Binary to Decimal
13
13 4 Conversion from decimal to octal: The decimal number is first divided by 8. The remainder is the LSB. The quotient is then divide by 8 and the remainder is the next significant bit and so on. Convert 1122 to octal. MSB LSB Conversion from Decimal to Octal
14
14 Convert (0.3152) 10 to octal (give answer to 4 digits). 0.3152 x 8 = 2 + 0.5216 a -1 = 2 0.5216 x 8 = 4 + 0.1728 a -2 = 4 0.1728 x 8 = 1 + 0.3824 a -3 = 1 0.3824 x 8 = 3 + 0.0592 a -4 = 3 (1122.3152) 10 = ( ? ) 8 Conversion from Decimal to Octal
15
15 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 Octal Table 1-2 page: 8
16
16 4 Conversion from and to binary, octal, and hexadecimal plays and important part in digital computers. and since each octal digit corresponds to 3 binary digits and each hexa digit corresponds to 4 binary digits. (010 111 100. 001 011 000) 2 = (274.130) 8 (0110 1111 1101. 0001 0011 0100) 2 = (6FD.134) 16 from table Conversion using Table
17
17 Addition of Binary Numbers
18
18 Subtraction of Binary Numbers
19
19 Sign Magnitude Representation
20
20 4 Complements: They are used in digital computers for subtraction operation and for logic manipulation. 2’s complement and 1’s complement 10’s complement and 9’s complement Binary Numbers Decimal Numbers 9’s complement of N = (10 n -1) – N (N is a decimal #) 1’s complement of N = (2 n -1) – N (N is a binary #) 1’s complement can be formed by changing 1’s to 0’s and 0’s to 1’s 10’s complement of N = 10 n – N (N is a decimal #) 2’s complement of a number is obtained by leaving all least significant 0’s and the first 1 unchanged, and replacing 1’s with 0’s and 0’s with 1 in all higher significant digits. Complements
21
21 The 9’s complement of 12345 = (10 5 – 1) – 12345 = 87654 The 9’s complement of 012345 = (10 6 – 1) – 012345 = 987654 9’s complement of N = (10 n -1) – N (N is a decimal #) 10’s complement of N = [(10 n – 1) – N] + 1 (N is a decimal #) The 10’s complement of 739821 = 10 6 – 739821 = 260179 The 10’s complement of 2500 = 10 4 – 2500 = 7500 4 4 Find the 9’s and 10’s-complement of 00000000 ANS: 99999999 and 00000000 Complements
22
22 1’s complement of N = (2 n -1) – N (N is a binary #) 1’s complement can be formed by changing 1’s to 0’s and 0’s to 1’s 2’s complement of a number is obtained by leaving all least significant 0’s and the first 1 unchanged, and replacing 1’s with 0’s and 0’s with 1 in all higher significant digits. 4 The 1’s complement of 1101011 = 0010100 The 2’s complement of 0110111 = 1001001 Find the 1’s and 2’s-complement of 10000000 Answer: 01111111 and 10000000 1’s and 2’s Complements
23
23 Comparison between 1’s and 2’s Complements 1’s complement –easier to implement by digital components since the only thing that must be done is to change 0’s to 1’s and 1’s into 0’s. COMPLEMENTS 2’s complement –may be obtained in two ways: (1) By adding 1 to the least significant digit of the 1’s complement
24
24 Comparison between 1’s and 2’s Complements 2’s complement (2) by leaving all leading 0’s in the least significant positions and the first 1 unchanged, and only then changing all 1’s into 0’s and all 0’s into 1’s. COMPLEMENTS During subtraction of two numbers by complements, the 2’s complement is advantageous – only one arithmetic addition operation is required
25
25 Comparison between 1’s and 2’s Complements 1’s complement - requires two arithmetic additions when an end-around carry occurs. COMPLEMENTS 1’s complement has the additional disadvantage of possessing two arithmetic zeros: one w/ all 0’s and one w/ all 1’s.
26
26 Comparison between 1’s and 2’s Complements Consider the subtraction of two equal binary numbers 1100-1100 = 0 –Using 1’s complement: 1100 + 0011 + 1111 COMPLEMENTS complement again to obtain –0000 –Using 2’s complement: 1100 + 0100 + 0100 + 0000 + 0000
27
27 Comparison between 1’s and 2’s Complements While the 2’s complement has only one arithmetic zero, the 1’s complement zero can be positive or negative, which may complicate matters. COMPLEMENTS 1’s complement is also useful in logical manipulations, since the change of 1’s to 0’s and vice versa is equivalent to a logical inversion operation.
28
28 Subtraction with digital hardware using complements: Subtraction of two n-digit unsigned numbers M – N base r: 1.Add M to the r’s complement of N: M + (r n – N) 2.If M N, the sum will produce an end carry and is equal to r n that can be discarded. The result is then M – N. 3. If M N, the sum will not produce an end carry and is equal to r n – (N – M) Subtraction Using Complements 4
29
29 Subtract 150 – 2100 using 10’s complement: M = 150 10’s complement of N = + 7900 Sum = 8050 Answer: – (10’s complement of 8050) = – 1950 There’s no end carry negative Subtract 7188 – 3049 using 10’s complement: M =7188 10’s complement of N = + 6951 Sum = 14139 Discard end carry 10 4 = – 10000 Answer = 4139 Decimal Subtraction using complements
30
30 Subtract 1010100 – 1000011 using 2’s complement: A = 1010100 2’s complement of B = + 0111101 Sum = 10010001 Discard end carry = – 10000000 Answer = 0010001 Binary subtraction is done using the same procedure. 4 end carry Subtract 1000011 – 1010100 using 2’s complement: Answer = – 0010001 Binary Subtraction using complements
31
31 Subtract 1010100 – 1000011 using 1’s complement: A = 1010100 1’s complement of B = + 0111100 Sum = 10010000 End-around carry = + 1 Answer = 0010001 Subtract 1000011 – 1010100 using 1’s complement: Answer = – 0010001 Binary Subtraction using complements
32
32 Arithmetic addition Negative numbers must be initially in 2’s complement form and if the obtained sum is negative, it is in 2’s complement form. + 600000110 +13 00001101 +19 00010011 –611111010 +13 00001101 +7 00000111 Answer = 11101101 Add –6 and –13
33
33 BINARY CODES Error-Detection Codes –Binary information, be it pulse-modulated signals or digital computer input or output, may be transmitted through some form of communication medium such as wires or radio waves. –Any external noise introduced into a physical communication medium changes bit values from 0 to 1 or vice versa. –An error-detection code can be used to detect errors during transmission. –The detected error cannot be corrected, but its presence is indicated.
34
34 Error-Detecting Code To detect the error in data communication, an eighth bit is added to ASCII character to indicate its parity. A parity bit is an extra bit included with a message to make the total number of 1’s either even or odd The 8-bit characters included parity bits (with even parity) are transmitted to their destination. If the parity of received character is not even it means at least one bits has been changed.
35
35 BINARY CODES A parity bit is an extra bit included w/ a message to make the total number of 1’s either odd or even. During transfer of info. from one location to another, the parity bit is handled as follows: In the sending end, the message is applied to a “parity-generation” network where the required P bit is generated. The message, including the parity bit, is transferred to its destination.
36
36 BINARY CODES (a) MessageP (odd)(b) MessageP (even) 00001 0 00010 1 00100 1 00111 0 01000 1 01011 0 01101 0 01110 1 10000 1 PARITY-BIT GENERATION
37
37 BINARY CODES 10011 0 10101 0 10110 1 11001 0 11010 1 11100 1 11111 0 PARITY-BIT GENERATION
38
38 In the receiving end, all incoming bits are applied to a “parity-check” network to check the proper parity adopted. An error is detected if the checked parity does not correspond to the adopted one. The parity method detects the presence of one, three, or any odd combination of errors. An even combination is undetectable. Consider odd parity for a bit data 1111. Received= 11111 (No error) Received= 11110 (1-bit error detected) Received= 11100 (2-bit error not detected) Received= 11000 (3-bit error detected) BINARY CODES
39
39 Reflected Code(also known as the Gray code) Digital systems can be designed to process data in discrete form only. Many physical systems supply continuous output data. These data must be converted into digital or discrete form before they are applied to a digital system. Advantage: A number in the reflected code changes by only one bit as it proceeds from one number to the next. BINARY CODES
40
40 BINARY CODES Reflected CodeDecimal Equivalent 00000 00011 00112 00103 01104 01115 01016 01007 11008
41
41 11019 111110 111011 101012 101113 100114 100015
42
42 Alphanumeric Codes Many applications of digital computers require the handling of data that consist not only of numbers, but also of letters. An alphanumeric code is a binary code of a group of elements consisting of the 10 decimal digits, the 26 letters of the alphabet, and a certain number of special symbols such as $. BINARY CODES
43
43 The total number of elements in an alphanumeric group is greater than 36. Therefore, it must be coded with a minimum of 6 bits (2 6 = 64, but 2 5 = 32 is insufficient). One possible arrangement of a 6-bit alphanumeric code is shown in the table under the name “internal code.” The need to represent more than 64 characters gave rise to 7- and 8- bit alphanumeric codes. One such code is known as ASCII. Another is known as EBCDIC. BINARY CODES
44
44 ALPHANUMERIC CHARACTER CODES Character6-Bit internal code 7-Bit ASCII code 8-Bit EBCDIC code 12-Bit card code A010 001100 00011100 000112,1 B010 100 00101100 001012,2 C010 011100 00111100 001112,3 D010 100100 01001100 010012,4 E010 101100 01011100 010112,5 F010 110100 01101100 011012,6 G010 111100 01111100 011112,7
45
45 ALPHANUMERIC CHARACTER CODES H011 000100 10001100 100012,8 I011 001100 10011100 100112,9 J100 001100 10101101 000111,1 K100 010100 10111101 001011,2 L100 011100 11001101 001111,3 M100 100 11011101 010011,4 N100 101100 11101101 010111,5 O100 110100 11111101 011011,6 P100 111101 00001101 011111,7
46
46 Q101 000101 00011101 100011,8 R101 001101 00101101 100111,9 S110 010101 00111110 00100,2 T110 011101 01001110 00110,3 U110 100101 01011110 01000,4 V110 101101 01101110 01010,5 W110 101 01111110 01100,6 X110 111101 10001110 01110,7 Y111 000101 10011110 10000,8 Z111 001101 10101110 10010,9
47
47 When discrete info. is transferred through punch cards, the alphanumeric characters use a 12- bit binary code. A punch card consists of 80 columns and 12 rows - in each column an alphanumeric character is represented by holes punched in the appropriate rows. A hole is sensed as a 1 and the absence of a hole is sensed as a 0. 12-BIT CARD CODE The 12 rows are marked, starting from the top, as the 12, 11, 0, 1, 2,…,9 punch. The first 3 are called the zone punch and the last 9 are called the numeric punch.
48
48 The 12-bit card code is inefficient w/ respect to the number of bits used. Most computers translate the input code into an internal 6-bit code. As an example, the internal code representation of the name “John Doe” is: 100001 100110 011000 100101 110000 J O H N blank BINARY CODES 010100 100110 010101 D O E
49
49 Binary Storage and Registers Register is a group of binary cells that are responsible for storing and holding the binary information. Register transfer operation is transferring binary operation from one set of registers to another set of registers. Digital logic circuits process the binary information stored in the registers.
50
50
51
51
52
52 Binary Logic Binary logic or Boolean algebra deals with variables that take on two discrete values. Binary logic consists of binary variables (e.g. A,B,C, x,y,z and etc.) that can be 1 or 0 and logical operations such as: AND: x.y=z or xy=z (see AND truth table) OR: x + y =z (see OR truth table) NOT: x’ =z (not x is equal to z) Note that binary logic is different from binary arithmetic. For example in binary logic 1 + 1 =1 (1OR1) but in binary arithmetic 1 + 1 = 10 (1 PLUS 1)
53
53 Logic Gates Logic gates are electronic circuits that operate on one or more input signals to produce an output signal. Electrical signal can be voltage. Voltage-operated circuits respond to two separate levels equal to logic 1 or 0. Logical gates can be considered as a block of hardware that produced the equivalent of logic 1 or logic 0 output signals if input logical requirement are satisfied
54
54
55
55
56
56 AND Symbol is dot –C = A · B Or no symbol –C = AB Truth table -> C is 1 only if –Both A and B are 1
57
57 OR Symbol is + –Not addition –C = A + B Truth table -> C is 1 if either 1 –Or both!
58
58 NOT Unary Symbol is bar –C = Ā Truth table -> Inversion
59
59
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.