Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal.

Similar presentations


Presentation on theme: "Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal."— Presentation transcript:

1 Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal Numbers 1.5. Complements 1.6. Signed Binary Numbers 1.7. Arithmetic Operations in Bases 1.8. Logic Gates Chapter 1 – page: 1 EE208: Logic Design 1434-1435 Dr. Ridha Jemal By Dr. Ridha Jemal Electrical Engineering Department College of Engineering King Saud University 1434-1435

2 Introduction to Digital Systems Chapter 1 – page: 2 Digital systems are built from circuits that process binary digits 0s and 1s and are used in: o Communication; o Traffic control and Space guidance; o Medical treatment; o Weather monitoring; o Digital telephone, Television and Camera o Digital Computer and Internet The purpose of this chapter is to show you how familiar numeric quantities can be represented and manipulated in a digital system, and how nonnumeric data, events, and conditions also can be represented One characteristic of Digital Systems is their ability to manipulate discrete element of information like : o 10 decimal digits from 0..9 ; o 26 letters of the alphabet from a.. Z o etc… EE208: Logic Design 1434-1435 Dr. Ridha Jemal

3 Chapter 1 – page: 3 Discrete elements of information are represented in digital system by physical quantities called signals (Electrical Signals like voltage or current)  The electronic device called transistor predominates in the circuitry that implements these signals. The signals use just two discrete values and therefore said to be binary. Therefore, a digital system designer must establish some correspondence between the binary digits processed by digital circuits and real-life numbers, events, and conditions. In Electrical Wire: 0 refers to the state “No current in the wire” 1 refers to the state “There is a current in the wire” Discrete elements of information are represented with a group of bits called binary Codes. For example: Decimal digits 0 to 9 are represented in digital system with code of 4 bits. Introduction to Digital Systems EE208: Logic Design 1434-1435 Dr. Ridha Jemal

4 Chapter 1 – page: 4 The Digital System is a system that manipulates discrete elements of information that is represented internally in binary form. The general purpose of digital compute is the best known example of digital system. The major parts of a computer are: o Central Processor Unit: It performs arithmetic and logic operations and other data processing. o Memory Unit: It stores programs as well as input, output and intermediate data. o Input/Output Unit: The program and data prepared by a user are transferred into memory by means of an input device such as keyboard. An output device as printer, receives the results of the computation to be printed. A digital System is an interaction of digital modules Introduction to Digital Systems EE208: Logic Design 1434-1435 Dr. Ridha Jemal

5 Chapter 1 – page: 5 A digital System is an interaction of digital modules To understand the operation of each digital module it is necessary to have a basic knowledge of digital circuits and their logic function The digital computer manipulates : o Numerical values; o Logic Values; o Set of symbol o Misc objects: voice, images, etc… CPU Memory IO A digital System is an interaction of digital modules Introduction to Digital Systems EE208: Logic Design 1434-1435 Dr. Ridha Jemal

6 Chapter 1 – page: 6 A digital System is an interaction of digital modules Binary Numbers EE208: Logic Design 1434-1435 Dr. Ridha Jemal A decimal number 7251 represents a quantity equal to : 7 thousands + 2 hundreds + 5 tens + 1 unit To be more exact this number should be written as: 7 x 10 3 + 2 x 10 2 + 5 x 10 1 + 1 x 10 0 In general a number with decimal point is represented by a series of coefficients as follows : a 4 a 3 a 2 a 1 a 0 a -1 a -2 a -3 The a j coefficients are any of the 10 digits (0, 1, 2, …, 9), and the subscript value j gives the place value and, hence, the power of 10 by which the coefficient must be multiplied. This can be expressed as: a 4 x 10 4 + a 3 x 10 3 + a 2 x 10 2 + a 1 x 10 1 + a 0 x 10 0 + a -1 x 10 -1 + a -2 x 10 -2 + a -3 x 10 -3 The General form can be expressed as: a n x 10 n + a n-1 x 10 n-1 + + a 0 x 10 0 + a -1 x 10 -1 + + a -m x 10 -m n = (digit number before the point )-1 m = digit number after the point

7 Chapter 1 – page: 7 A digital System is an interaction of digital modules EE208: Logic Design 1434-1435 Dr. Ridha Jemal The decimal number system is said to be of base or radix 10 because it uses 10 digits and the coefficient are multiplied by power of 10. The binary system is a different number system. The coefficients of the binary number have only two possible values : 0 or 1. Each coefficient a j is multiplied by 2 j For example, the decimal equivalent of the binary number 11010.11 is ……….. as shown from the multiplication of the coefficient by powers of 2 1 x 2 4 + 1 x 2 3 + 0 x 2 2 + 1 x 2 1 + 0 x 2 0 + 1 x 2 -1 + 1 x 2 -2 = 26.75 For example, a number expressed in a base-r system has coefficients multiplied by powers of r a n x r n + a n-1 x r n-1 + + a 2 x r 2 + a 1 x r 1 + a 0 x r 0 + a -1 x r -1 + + a -m x r -m Binary Numbers

8 Chapter 1 – page: 8 A digital System is an interaction of digital modules EE208: Logic Design 1434-1435 Dr. Ridha Jemal Binary Numbers There are may bases: o Binary System : r = 2 It manipulates 2 digits or bits 0, 1 o Base-5 System: r = 5 It manipulates 5 digits : 0, 1, 2, 3, 4 o Octal System : r = 8 It manipulates 8 digits : 0, 1, 2, 3, 4, 5, 6, 7 o Hexadecimal System : r = 16 It manipulates 16 digits : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Examples: o (4021.2) 5 = o (127.4) 8 = o (B65F) 16 = o (110101) 2 = 511.4 10 87.5 10 46687 10 53 10

9 Chapter 1 – page: 9 A digital System is an interaction of digital modules Number Base Conversion EE208: Logic Design 1434-1435 Dr. Ridha Jemal The conversion of a number in base r to decimal is done by expanding the number in a power series and adding the terms as shown previously: In fact, the general form of a number D is : a n …. a 2 a 1 a 0 a -1 a -2 …a -m And its value expressed in the base r is: where r is the radix of the number and there are n digits to the left of the radix point and m to the right. For example if r=10, the value of the number can be found by converting each digit of the number to its radix-10 equivalent and expanding the formula using radix-10 arithmetic. Some examples are given below: 1CE8 16 = 1·16 3 + 12·16 2 + 14·16 1 + 8·16 0 = 740010 F1A3 16 = 15·16 3 + 1·16 2 + 10·16 1 + 3·16 0 = 6185910 436.5 8 = 4·8 2 + 3·8 1 + 6 ·8 0 + 5·8 –1 = 286.62510 132.3 4 = 1·4 2 + 3·4 1 + 2 ·4 0 + 3·4 –1 = 30.7510 a n x r n + a n-1 x r n-1 + + a 2 x r 2 + a 1 x r 1 + a 0 x r 0 + a -1 x r -1 + + a -m x r -m

10 Chapter 1 – page: 10 A digital System is an interaction of digital modules EE208: Logic Design 1434-1435 Dr. Ridha Jemal Number Base Conversion We now present a general procedure for the reverse operation of converting a decimal number to a number of base r Consider what happens if we divide the formula by r we will get a quotient Q and a reminder d i. The quotient has the same form as the original formula.Therefore, successive divisions by r will yield successive digits of D from right to left, until all the digits of D have been derived. The sequence of reminders are listed in the reverse order of the division process Decimal Integer to Binary Conversion 179 : 2 = 89 remainder 1 (LSB) : 2 = 44 remainder 1 : 2 = 22 remainder 0 : 2 = 11 remainder 0 : 2 = 5 remainder 1 : 2 = 2 remainder 1 : 2 = 1 remainder 0 : 2 = 0 remainder 1 (MSB) The result can be expressed as : 179 10 = 10110011 2

11 Chapter 1 – page: 11 A digital System is an interaction of digital modules Number Base Conversion EE208: Logic Design 1434-1435 Dr. Ridha Jemal Decimal Fraction to Binary Conversion Similar method is applied, just the division is replaced by multiplication for the right after the point Example : 0.6875 10 0.6875x2 = 1 + 0.3750 0.3750X2 = 0+0.7500 0.7500x2= 1+0.5000 0.5000x2=1+0.0000 0.6875 10 = 0.1011 2 Decimal Fraction to Octal Conversion 0.513 10 0.513x8 = 4 + 0.104 0.104X8 = 0+0.832 0.832x8= 6+0.656 0.656x8=5+0.248 0.248x8= 1+0.984 0.984x8=7+0.872 0.513 10 = 0.406517 8

12 Chapter 1 – page: 12 A digital System is an interaction of digital modules Number Base Conversion EE208: Logic Design 1434-1435 Dr. Ridha Jemal Binary to Octal/Hexadecimal Conversion The conversion is easily accomplished by partitioning the binary number into group of three digits for the octal conversion and four digits for the hexadecimal conversion Examples : o (10 110 001 101 011. 111 100 000 110) 2 = (26153.7406) 8 o (10 1100 0110 1011. 1111 0010) 2 = (2C6B.F2) 16 The conversion from and to binary, octal and Hexadecimal plays an important role in digital computers. Since 2 3 =8 and 2 4 =16 each octal digit corresponds to three binary digits and each hexadecimal digit correspond to four binary digits. Octal/Hexadecimal to Binary Conversion Conversion from octal or hexadecimal to binary is done by reversing the preceding procedure. Each octal digit is converted to its three-digit binary equivalent. Similarly, each hexadecimal digit is converted to its four-digit binary equivalent. Examples : o (673.124) 8 = (110 111 011. 001 010 100) 2 o (306.D) 16 = (0011 0000 0110. 1101) 2

13 Chapter 1 – page: 13 A digital System is an interaction of digital modules Number Base Conversion EE208: Logic Design 1434-1435 Dr. Ridha Jemal Decimal (Base 10) Binary (Base 2) Octal (Base 8) Hexadecimal (Base 16) 0000 0 010001011 020010022 030011033 040100044 0501 5 060110066 070111077 081000108 091001119 101012A 11101113B 12110014C 13110115D 14111016E 151117F

14 Chapter 1 – page: 14 A digital System is an interaction of digital modules Complements EE208: Logic Design 1434-1435 Dr. Ridha Jemal Complements are used in digital computer for simplifying the subtraction operation and for logical manipulation. There are two types of complements for each base-r system: The radix complement (r’s complement) The diminished radix complement ((r-1)’s complement) Given a number N in base r having n digits, the (r-1)’s complement of N is defined as (r n – 1) –N o For r=10, r-1=9, so the 9’s complement of N is (10 n -1) – N The 9’s complement of 546700 is 999999 – 546700 = 453299 The 9’s complement of 012398 is 999999 – 012398 = 987601 o For r=2, r-1=1, so the 1’s complement of N is (2 n -1) – N o N=4 ; 24= 10000 2 and 24 – 1=1111. The 1’s complement is obtained by subtracting each digit from 1. We have one of the following cases :1 -0 or 1-1. The (r-1)s complement

15 Chapter 1 – page: 15 A digital System is an interaction of digital modules Complements EE208: Logic Design 1434-1435 Dr. Ridha Jemal The r’s complement = the (r-1)’s complement + 1 [(r n – 1) –N]+1 o For r=10, The 10’s complement of 012398 is 987602 The 10’s complement of 246700 is 753300 o For r=2, Given a binary umber 10100101 The 1’s complement of 10100101 is 01011010 The 2’s complement of 10100101 is 01011010+1 = 01011011 The radix complement (r’s complement) The 1’s complement is obtained by changing 1’s to 0’s and 0’s to 1’s The 1’s complement of 1011000 is 0100111

16 Chapter 1 – page: 16 A digital System is an interaction of digital modules Signed Binary Numbers EE208: Logic Design 1434-1435 Dr. Ridha Jemal Negative Number The sign is represented by a bit placed in the leftmost position of the number. The convention is to make the sign bit 0 for positive 1 for negative. Positive integers can be represented by unsigned numbers. However, to represent negative integers, we need a notation for negative values 0 1010010 as unsigned number is equal to : 1 1010010 as unsigned number is equal to : 1 1010010 as signed number is equal to :

17 Chapter 1 – page: 17 A digital System is an interaction of digital modules Signed Binary Numbers EE208: Logic Design 1434-1435 Dr. Ridha Jemal Number line extends in both directions: Ways to represent numbers less than zero: Signed Magnitude Use MSB as a flag: 0=+ve, 1=-ve ("sign bit") All other bits hold the magnitude eg. using 4 bits 0110 = 6 1010 = -2 One’s Complement Given a number N in base 2 having n digits, the 1’s complement of N is defined as (2 n – 1) –N The 1’s complement is obtained by changing 1’s to 0’s and 0’s to 1’s The 1’s complement of 1011011 is 0100100

18 Chapter 1 – page: 18 A digital System is an interaction of digital modules Signed Binary Numbers EE208: Logic Design 1434-1435 Dr. Ridha Jemal Two’s Complement To negate number: Invert all bits and add 1 ; eg. -2 using 8 bits * 0000 0010 inverted is 1111 1101 * Add 1: 1111 1110 (-2) Another way: Start writing down the number from left. Write the number exactly as it appears until the first one. Write down the first one and invert all digits to its left Examples : Find the 2’s complement using 8 bits 1. +8 = 00001000 1000 write number to first one 111 invert the remaining bits -8 = 11111000 1. +13 = 00001101 1’s com.: 11110010 2’s com.: 11110011 -13 = 11110011

19 Chapter 1 – page: 19 A digital System is an interaction of digital modules Arithmetic Operations in bases (Add, Sub) EE208: Logic Design 1434-1435 Dr. Ridha Jemal If the signs are the same, we add two magnitudes and gives the common sign Example 1 : +8001000+ 240011000 +17010001+ 320100000 ------------------------------- --------------------------------------- +25011001+560111000 Addition/subtraction If the signs are different, we subtract the smaller magnitude from the larger and we give the result the sign of the larger magnitude. This process requires a comparison and subtraction. So we will use only the addition in the signed complement system without need to use the comparison and the subtraction. Subtraction = Addition of the 2’s complement of the negative number

20 Chapter 1 – page: 20 A digital System is an interaction of digital modules EE208: Logic Design 1434-1435 Dr. Ridha Jemal Arithmetic Operations in bases (Add, Sub) Example 2 +17 010001 010001 -81010001110002’s complement of 001000 The sign bit is not complemented ----------------------------------------------------- +9001001 If the result is negative, we will take its 2’s complement to get the final result Example 3: + 240011000 0011000 - 35110001110111012’s complement of 0100011 ---------------------------------------------------------------------- 1110101 It’s a negative number, we take its 2’s complement which is : 1001011 equal to -11

21 Chapter 1 – page: 21 A digital System is an interaction of digital modules EE208: Logic Design 1434-1435 Dr. Ridha Jemal Example 4: +35 -72 = ??? + 3500100011 00100011 - 721100100010111000 2’s complement 0f 01001000 --------------------------------------- 11011011 It’s a negative number, we take its 2’s complement which is : 00100101 equal to - 37 Arithmetic Operations in bases (Add, Sub)

22 Chapter 1 – page: 22 A digital System is an interaction of digital modules Binary Code – Character Sets EE208: Logic Design 1434-1435 Dr. Ridha Jemal ASCII - American Standard Code for Information Interchange a.k.a ISO 646-1973 (international) BS 4730: 1974 (British Standard) 7-bit code (128 different characters) Numerals, punctuation and letters American alphabet...... no symbols for ö, å, ñ etc. Still VERY widely used EBCDIC - Extended Binary-Coded-Decimal Interchange Code Proprietary to IBM 8-bit code Not compatible with ASCII ISO Latin1 - 8-bit code Extension to ASCII (ASCII is compatible) Has characters for European languages Future - include ALL characters from ALL languages (!) Unicode (16 bits) ISO 10646 (32 bits)

23 Chapter 1 – page: 23 A digital System is an interaction of digital modules Binary Codes EE208: Logic Design 1434-1435 Dr. Ridha Jemal Digital Systems represent and manipulate not only binary numbers but also many other discrete elements of information which can be represented by a binary code. An n-bit binary code is a group of n bits that assume up to 2 n distinct combinations of 1’s and 0’s. Examples: o A set of four elements can be coded with two bits: 00, 01, 10 and 11 o A set of 16 elements requires a 4-bit code BCD Code (Binary Coded Decimal) Decimal SymbolBCD Digit 00000 10001 20010 30011 40100 50101 60110 70111 81000 91001 A number with k decimal digits will require 4k bits in BCD (396) 10 = (0011 1001 0110) BCD

24 Chapter 1 – page: 24 A digital System is an interaction of digital modules Binary Codes EE208: Logic Design 1434-1435 Dr. Ridha Jemal Consider the addition of two decimal digits in BCD, together with a possible carry from previous less significant pair of bits: If the result is greater or equal 1010, the result is an invalid BCD digit; The addition of 6 = (0110) 2 to the binary sum converts it to the correct digit and also produces a carry as required. Examples: 4 0100 4 0100 +5+0101+8+1000 --------------------------------------- +9 100112 1100 + 0110 ---------------------- 121 0010 BCD Addition

25 Chapter 1 – page: 25 A digital System is an interaction of digital modules Binary Codes EE208: Logic Design 1434-1435 Dr. Ridha Jemal BCD Addition (contd.) The addition of two n-digit unsigned BCD numbers follows the same procedure. Consider the addition of 184 +576 184 000110000100 +576+0101 01110110 -------------------------------- 011011111010 + 01100110 + 1 1 -------------------------------- 011101100000 7 6 0

26 Chapter 1 – page: 26 A digital System is an interaction of digital modules Gray and ASCII Codes EE208: Logic Design 1434-1435 Dr. Ridha Jemal Gray Code Decimal Equivalent 00000 00011 00112 00103 01104 01115 01016 01007 11008 11019 111110 111011 101012 101113 100114 100015 ASCII CodeCharacters 100 0001A 110 0001a 100 0010B 110 0010b...... 100 0110F 110 0110f 100 0111G 110 0111g...... 011 0001= 31 Hex 1 011 0011= 33 Hex 3

27 Chapter 1 – page: 27 A digital System is an interaction of digital modules Binary Logic EE208: Logic Design 1434-1435 Dr. Ridha Jemal AND gate Binary Logic consists on Binary variables and Logical operations o Variables : A, B, C, …. Z, a, b, c, …1, 2, 3 expressed in the binary system o Logical Operations : 3 fundamental operations A ND, OR, INV ABC 000 010 100 111 AND : Result TRUE if and only if both input operands are true C= AB Its graphic Symbol is: A B C

28 Chapter 1 – page: 28 A digital System is an interaction of digital modules Binary Logic EE208: Logic Design 1434-1435 Dr. Ridha Jemal ABC 000 011 101 111 OR : Result TRUE if operands are true C= A+B Its graphic Symbol is: NOT : Result TRUE if single input value is FALSE C= A Its graphic Symbol is: AC 01 10 A B C A C


Download ppt "Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal."

Similar presentations


Ads by Google