Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore BCA 111 DCLD

BCA 111 DCLD

Published by Teamlease Edtech Ltd (Amita Chitroda), 2020-12-04 14:27:40

Description: BCA 111 DCLD

Search

Read the Text Version

INSTITUTE OF DISTANCE & ONLINE LEARNING BACHELOR OF COMPUTER APPLICATIONS DIGITAL CIRCUITS AND LOGIC DESIGNS (THEORY AND PRACTICAL) BCA111/BCA116 Self Learning Material R101

BACHELOR OF COMPUTER APPLICATIONS DIGITAL CIRCUITS AND LOGIC DESIGNS (THEORY AND PRACTICAL) BCA111/BCA116 Kiran Gurbani

CHANDIGARH UNIVERSITY Institute of Distance and Online Learning Course Development Committee Chairman Prof. (Dr.) R.S. Bawa Vice Chancellor, Chandigarh University, Punjab Advisors Prof. (Dr.) Bharat Bhushan, Director, IGNOU Prof. (Dr.) Majulika Srivastava, Director, CIQA, IGNOU Programme Coordinators & Editing Team Master of Business Administration (MBA) Bachelor of Business Administration (BBA) Co-ordinator - Prof. Pragya Sharma Co-ordinator - Dr. Rupali Arora Master of Computer Applications (MCA) Bachelor of Computer Applications (BCA) Co-ordinator - Dr. Deepti Rani Sindhu Co-ordinator - Dr. Raju Kumar Master of Commerce (M.Com.) Bachelor of Commerce (B.Com.) Co-ordinator - Dr. Shashi Singhal Co-ordinator - Dr. Minakshi Garg Master of Arts (Psychology) Bachelor of Science (Travel & Tourism Management) Co-ordinator - Ms. Nitya Mahajan Co-ordinator - Dr. Shikha Sharma Master of Arts (English) Bachelor of Arts (General) Co-ordinator - Dr. Ashita Chadha Co-ordinator - Ms. Neeraj Gohlan Master of Arts (Mass Communication and Bachelor of Arts (Mass Communication and Journalism) Journalism) Co-ordinator - Dr. Chanchal Sachdeva Suri Co-ordinator - Dr. Kamaljit Kaur Academic and Administrative Management Prof. (Dr.) Pranveer Singh Satvat Prof. (Dr.) S.S. Sehgal Pro VC (Academic) Registrar Prof. (Dr.) H. Nagaraja Udupa Prof. (Dr.) Shiv Kumar Tripathi Director – (IDOL) Executive Director – USB © No part of this publication should be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording and/or otherwise without the prior written permission of the author and the publisher. SLM SPECIALLY PREPARED FOR CU IDOL STUDENTS Printed and Published by: Himalaya Publishing House Pvt. Ltd., E-mail: [email protected], Website: www.himpub.com For: CHANDIGARH UNIVERSITY Institute of Distance and Online Learning CU IDOL SELF LEARNING MATERIAL (SLM)

Digital Circuits and Logic Designs (Theory and Practical) Course Code: BCA111/ BCA116 Credits: 3 (Theory)/1 (Practical) Course Objectives:  To familiarize the basics of Boolean algebra and the operation of logic components, combinational and sequential circuits.  To enable the students to design digital circuits and systems.  To practice the workingof the Microprocessors and Memory Mapping. Syllabus Unit - 1 – Number System 1: Decimal Numbers, Binary Numbers, Binary Arithmetic, 1’s sand 2’s Complements Octal Numbers, Hexa Decimal Numbers Unit - 2 – Number System 2: Inter-conversions of Number Systems, Digital Codes: Binary Coded Decimal (BCD), Gray Code, Excess-3code, ASCII Code. Unit - 3 – Logic Gates 1: Positive and Negative Logic, NOT Gate, OR Gate, AND Gate, AND Gate, NOR Gate, EX-OR and EX-NOR Gates. Unit - 4 – Logic Gates 2: Symbol, Truth Table, Circuit Diagram for basic Gates using Diodes and Transistors, Universal Properties of NAND & NOR Gates. Unit - 5 – Boolean Algebra 1: Boolean Operations, Logic Expressions, Rules and Laws of Boolean Algebra. Unit - 6 – Boolean Algebra 2: DeMorgan’s Theorems, Simplification of Boolean Expressions using Boolean Algebra Techniques. Unit - 7 – SOP and POS 1: form of Boolean expressions for logic network, min- terms, max- terms,. CU IDOL SELF LEARNING MATERIAL (SLM)

Unit - 8 – SOP and POS 2: Simplification of Boolean Expressions using Karnaugh Map Techniques (up to 4 variables). Unit - 9 – Combinational Circuits: Difference between combinational and sequential circuit, Multiplexer, Demultiplexer, Adder and Subtractor. Unit - 10 – Microprocessor 1: Its Historical Background and Applications, 8085 Microprocessor Architectu6re and its Pin Diagram. Unit - 11 – Microprocessor 2: 8085 Interrupts, Memory Mapped I/O and Peripheral Mapped I/O, RISC v/s CISC Processors. Text Books: 1. Jain, R.P. (2010), Modern Digital Electronics,New Delhi:Tata McGraw Hill. 2. Thomas, L. Floyd (2015), Digital Fundamentals, Gorakhpur: Universal Publishing House. 3. William, H. Gothmann (1982), Digital Electronics: An Introduction to Theory and Practice, Delhi: Prentice Hall of India. 4. Malvino, A.P. (2010), Digital Principles and Applications, New York: McGraw Hill International Editions. Reference Books: 1. Roth, C.H. Jr. (2011), Fundamentals of Logic Design, Boston: PWS Publishing Company. 2. Harris, D. and Harris, S. (2012), Digital Design and Computer Architecture, Burlington: Morgan Kaufmann. 3. Wakerly, F. (2000), Digital Design, 3rd Edition, Upper Saddle River, NJ: Prentice Hall. 4. Roger L. Tokheim (1994), Digital Principles, 3rd Edition, Schaum’s Outline Series, New Delhi: McGraw-Hill Publications. CU IDOL SELF LEARNING MATERIAL (SLM)

Digital Circuits and Logic Designs Practical Course Code: BCA116 Credits: 3 (Theory)/1 (Practical) Course Objectives:  To explore the basic concepts of digital circuits and system, which leads to design of complex digital system such as microprocessors.  To demonstrate combinational and sequential circuits.  To practice the digital circuits and logical design in the electronics world. Syllabus Unit - 1 – Logic Gates 1. Verification of the truth tables of TTL gates, e.g., 7400, 7402, 7404, 7408, 7432 and 7486. 2. Design the basic gates using NAND gate. 3. Design the basic gates using NOR gate. Unit - 2 – Combinational Circuits 1. Verification of the truth table of the Multiplexer 74150. 2. Verification of the truth table of the Demultiplexer 74154. 3. Design and verification of the truth tables of half adder and full adder circuits using gates 7483. 4. Design and Verification of truth table of half subtractor and full subtractor. Unit - 3 – Microprocessor 1. Design and test of an SR flip-flop using NOR/NAND gates. 2. Verify the truth table of a J-K flip-flop. (7476) 3. Verify the truth table of a D flip-flop (7474). 4. Study of 8085 Microprocessor Kit. CU IDOL SELF LEARNING MATERIAL (SLM)

Text Books: 1. Jain, R.P. (2010), Modern Digital Electronics, New Delhi: Tata McGraw Hill. 2. Thomas, L. Floyd (2015), Digital Fundamentals, Gorakhpur: Universal Publishing House. 3. William H. Gothmann (1982), Digital Electronics: An Introduction to Theory and Practice, Delhi: Prentice Hall of India. 4. Malvino, A.P. (2010), Digital Principles and Applications, New York: McGraw Hill International Editions. Reference Books: 1. Roth, C.H. Jr. (2011), Fundamentals of Logic Design, Boston: PWS Publishing Company. 2. Harris, D. and Harris, S. (2012), Digital Design and Computer Architecture, Burlington: Morgan Kaufmann. 3. Wakerly, F. (2000), Digital Design, 3rd Edition, Upper Saddle River, NJ: Prentice Hall. 4. Roger L. Tokheim (1994), Digital Principles, 3rd Edition, Schaum’s Outline Series, New Delhi: McGraw-Hill Publications. CU IDOL SELF LEARNING MATERIAL (SLM)

CONTENTS 1 - 17 18 - 43 Unit 1: Introduction to Number System 44 - 53 Unit 2: Number System 54 - 77 Unit 3: Logic Gates 1 78 - 87 Unit 4: Logic Gates 2 88 - 99 Unit 5: Boolean Algebra 1 100 - 109 Unit 6: Boolean Algebra 2 110 - 121 Unit 7: SOP and POS 1 122 - 159 Unit 8: SOP and POS 2 160 - 176 Unit 9: Combinational Logic Circuits 177 – 191 Unit 10: Microprocessor 1 192 – 198 Unit 11: Microprocessor 2 199 – 209 210 – 235 Practical Unit 1: Logic Gates Practical Unit 2: Combinational Circuits Practical Unit 3: Microprocessor CU IDOL SELF LEARNING MATERIAL (SLM)

UNIT 1 INTRODUCTION TO NUMBER SYSTEM Structure: 1.0 Learning Objectives 1.1 Introduction 1.2 Number System 1.3 Decimal Number System 1.4 Binary Number System 1.5 Octal Number System 1.6 Hexadecimal Number System 1.7 Binary Arithmetic 1.8 1’s and 2’s Complement 1.9 Summary 1.10 Key Words/Abbreviations 1.11 Learning Activity 1.12 Unit End Questions (MCQ and Descriptive) 1.13 References CU IDOL SELF LEARNING MATERIAL (SLM)

2 Digital Circuits and Logic Designs 1.0 Learning Objectives After studying this unit, you will be able to:  Define number system  define binary operations  Explain coding  Describe binary arithmetic 1.1 Introduction Number systems use different number bases. A number base indicates how many different digits are available while using a particular numbering system. For example, decimal is number base 10, which means it uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Binary is number base 2, which means that it uses two digits: 0 and 1. Different number bases are needed for different purposes. Humans use number base 10 whereas computers use binary. The number base determines how many digits are needed to represent a number. For example, the number 78 in decimal (base 10) requires two digits. The binary (base 2) equivalent is 1001110 which requires seven digits. As a consequence of this, there are many instances in computing very long binary numbers. To solve this problem, other number bases can be used, which require fewer digits to represent numbers. For example, some aspects of computing use number base 16 which is referred to as hexadecimal. 1.2 Number System The number system is a system in which an ordered set of digits are used to specify any number. In mathematics, a 'number system' is a set of numbers. Binary, octal, decimal and Hexadecimal are the different number systems. CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 3 Table 1.1: Number System Sr. No. Number System Base Digits used 1 Decimal Number System 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 2 Binary Number System 2 0, 1 3 Octal Number System 8 0, 1, 2, 3, 4, 5, 6, 7 4 Hexadecimal Number System 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F The base of the number is defined as the total number of digits available in the number system. 1. Bit: The binary digit ‘O’ or ‘1’ in a binary number system is called a bit. (i) Example: 0,1 2. Byte: A group of eight bits is called a byte i.e. 1 byte = 8 bits. (i) Example: 01010101, 11110000, 11001100, 00111001 3. Nibble: A group of four bits is called a nibble i.e. 1 nibble = 4 bits (i) Example: 0101, 1111, 0011,1100 4. Least Significant Bit (LSB) (i) The rightmost bit in a number system is called a Least Significant Bit (LSB).D0 bit is called as Least Significant Bit. 5. Most Significant Bit (MSB) (i) The left most bit in a number system is called a Most Significant Bit( MSB). D7 bit is called as Most Significant Bit. 1.3 Decimal Number System A number system which uses ten digits, 0 to 9, is called decimal system. The numbers represented by the digit 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 are the decimal numbers. The base, i.e., radix of this number system is 10. The positions to the left or right of the decimal point carry weight increasing or decreasing in power of 10 respectively. CU IDOL SELF LEARNING MATERIAL (SLM)

4 Digital Circuits and Logic Designs Table 1.2: Decimal System D4 D3 D2 D1 D0 . D-1 D-2 D-3 D-4 10-4 104 103 102 101 100 . 10-1 10-2 10-3 Example: (9876)10 = 9 x 103 +8 x 103 + 7 x 103 + 6 x 103 Other example: (1234.5678)10, (2456.7777)10, (987.65453)10, Since 23 = 8, three binary bit can represent a Octal Digit. ie (111)2 = (7)8 1.4 Binary Number System It is system based on powers of 2. The number system which uses only two digits 0 and 1 is called binary number system.0 or 1 is called as binary Digit or Bit The numbers represented by the digits 0 and 1 are the binary numbers. The base, i.e., radix of this system is 2. The position to the left or right of the binary point carry weights increasing or decreasing in power of 2 respectively. Table 1.3: Binary Digit D4 D3 D2 D1 D0 . D-1 D-2 D-3 D-4 24 23 22 21 20 . 2-1 2-2 2-3 2-4 Example: 0,1 Binary numbers are widely used in digital computers and digital communication because digital systems only understand the language of binary numbers 0 and 1. Also, it becomes easier to analyze and design digital circuits. For example: ON and OFF position of a switch presence or absence of hole in a card, set and reset positions of Bistable circuits, etc.; can be conveniently used to represent binary numbers. CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 5 1.5 Octal Number System Characteristics  Uses eight digits, 0, 1, 2, 3, 4, 5, 6, 7.  Also called base 8 number system.  Each position in an octal number represents a number power of the base 8. Example: 80, 81, 82, ------ The decimal, binary and octal equivalent numbers are shown below. Table 1.4: Octal Number Decimal Binary Octal 0 000 0 1 001 1 2 010 2 3 011 3 4 100 4 5 101 5 6 110 6 7 111 7 Example: (2345)8 = 2 × 83 + 3 × 82 + 4 × 81 + 5 × 80 Other Examples: (2323.23476)8, (17675.4567)8, (2432145.214365)8 1.6 Hexadecimal Number System Hexadecimal number system has 10 symbol (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) Characteristics  Uses 10 digits and 6 letters. They are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.  Each letters represents numbers. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.  It is also called base 16 number system. CU IDOL SELF LEARNING MATERIAL (SLM)

6 Digital Circuits and Logic Designs The decimal, binary and hexadecimal equivalent numbers are shown below. Table 1.5: Hexadecimal Number Decimal Binary Hexadecimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F 1.7 Binary Arithmetic (A) Binary Addition Rules for Binary Addition Carry 0 Table 1.6: Binary Addition 0 Augend Addend Addition Result Sum Sum 0 1 00 00 01 11 10 11 11 10 0 CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 7 arithmetical operations 1. 1100111 + 101101 1. 1100111 + 101101 1 1 1 1 1 Carry 110111 + 101101 1 1 0 0 1 0 0 Sum (B) Binary Subtraction Rules for Binary Subtraction borrow 0 Table 1.7: Binary Subtraction 1 Minuend Subtrahend Difference 0 0 000 011 101 110 Subtract 1011 from 11010 Table 1.8: Binary Subtraction 1 1 0 1 0 minuend -0 1 01 1 Subtrahend 0 1 1 1 1 Difference (C) Binary Multiplication Multiply 1010 with 1101. Rules for binary multiplication Table 1.9: Binary Multiplication Multiplicant Multiplier Product 00 0 01 0 10 0 11 1 CU IDOL SELF LEARNING MATERIAL (SLM)

8 Digital Circuits and Logic Designs Example: 1010 × 1101 1010 0000× 01010 (D)Binary Division Rules for binary division – It is same as decimal division. Example: Divide 100110001 by 1011 Divisor by Quotient 11011 1011 1 0 0 1 1 0 0 0 1 Quotient - 1011 Dividend 010000 - 1011 00010100 - 1011 010011 - 1011 0 1 0 0 0 Remainder CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 9 1.8 1’s and 2’s Complement (a)1’s complement. In a binary number, if each 1 is replaced by 0 and each 0 is replaced by 1, the resulting number is known as the 1’s complement of the first number. In fact, both the numbers are complement to each other. If one of these number is positive, then the other number will be negative with the same magnitude and vice versa. Example: (0101) represents (+5)10 (1010) represents (-5)10 where (b) 2’s complement of a binary number. 2’s complement is obtained by adding 1 to 1’s complement of a binary number. 2’s complement method is used for subtraction operation in digital circuits with the use of 2’s complement representation for negative number, it is possible to use the circuit designed for binary addition for the purpose of binary subtraction also. Example (A) When Result is Positive (9)D = (1001)2 minuend (-7)D = (0111)2 substrend 0 1 1 1 1000 1’s complement of (0111)2 1001 2’s complement of (0111)2 (9)10 = (1001)2 (-7)D = + (1001)2 2’s complement of (0111)2 (2)D = 1 (0010)2 Discard final carry The answer is (0010)2 equivalent to (+2)10 CU IDOL SELF LEARNING MATERIAL (SLM)

10 Digital Circuits and Logic Designs (B) When Result is Negative (7)D = (0111)2 minuend (-9)D = - (1001)2 substrend 1 0 0110 1’s complement of (1001)2 +1 2’s complement of (1001)2 0111 (7)D = (0111)2 (-9)D = + (0111)2 (-2)D = 1 1 1 0 The final carry = 0 Therefore, answer is negative and 2’s complement of 1110 is = 1’s complement of 1110 + 1 = 000 Subtraction using 2’s complement Binary subtraction can be performed by adding the 2’s complement of the subtracted to the minuend. 1. If the final carry is generated discard the carry and the remaining bit is the answer which is positive. 2. If the final carry is 0, the answer is negative and is in 2’s complement form. Example: (A) When Result is Positive (9)D = (1001)2 minuend (-7)D = (0111)2 substrend 0 1 1 1 1 0 0 0 1’s complement of (0111)2 +1 CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 11 1 0 0 1 2’s complement of (0111)2 (9)10 = (1001)2 (-7)D = + (1001)2 2’s complement of (0111)2 (2)D = 1 (0010)2 Discard final carry The answer is (0010)2 equivalent to (+2)10 (D) When Result is Negative (7)D = (0111)2 minuend (-9)D = - (1001)2 substrend 10 01 1’s complement of (1001)2 0110 2’s complement of (1001)2 +1 0111 (7)D = (0111)2 (-9)D = + (0111)2 (-2)D = 1 1 1 0 The final carry = 0 Therefore, answer is negative and 2’s complement of 1110 is = 1’s complement of 1110 + 1 = 0001 + 1 = (0010)2 The answer is (-2)D CU IDOL SELF LEARNING MATERIAL (SLM)

12 Digital Circuits and Logic Designs Examples: Q.1. Convert following binary number to 1’s complement. (A) (1101)2 (B) (1011)2 Ans.: (A) (1101)2 = (?) 1’s complement (1101)2 (0010)2 (B) (1011)2 = (?) 1’s compliment (1011)2 (0100)2 Q.2. Perform the following operations by 1’scomplement method. (i) (1101)2 - (1001)2 (ii) (1011)2 - (0111)2 Ans.: (i) (1101)2 -(1001)2 (1101)2 Converting into signed form as (0000 1101)2 minuend and (1001)2 as (00001001) substrend Take 1’s complement of substrend, i.e., (11110110) and then add with minuend 11111 00001101 (Minuend) + 1 1 1 1 0 1 1 0 (Substrend) 100000011 + 1 Carry obtained so result is positive 0 0000100 Ans = + 4 (ii) (1011)2 - (0110)2 (1011)2 converting into signed form as (0000 1011)2 minuend and (0110)2 as (0000 0110) substrend Take 1’s complement of substend, i.e., (11111001) and then add with minuend. CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 13 11111 00001011 (Minuend) + 11111001 (Substrend) + 10000010 0 Ans = + 5 1 Carry obtained so result is positive 0 0000101 Q.3 What do you understand by 2’s complement of a number? How it is used for binary subtraction? Give example. OR Explain 2’s complement of a binary number. Ans.: 2’s complement is obtained by adding 1 to 1’s complement of a binary number. 2’s complement method is used for subtraction operation in digital circuits with the use of 2’s complement representation for negative number, it is possible to use the circuit designed for binary addition for the purpose of binary subtraction also. Subtraction using 2’s Complement Binary subtraction can be performed by adding the 2’s complement of the subtracted to the minuend. 1. If the final carry is generated discard the carry and the remaining bit is the answer which is positive. 2. If the final carry is 0, the answer is negative and is in 2’s complement form. Q.4 Perform following subtraction in binary number system 1. (93.5)10 - (42.75)10 Ans.: 1. (93.5)10 - (42.75)10 (93.5)10 = (1011101.1)2 (42.75)10 = (101010.11)2 CU IDOL SELF LEARNING MATERIAL (SLM)

14 Digital Circuits and Logic Designs 10 10 0 1 10 10 Borrow + 101110 1. 1 0 (Minuend) 1 0 1 0. 1 1 Subtrahend 0 1 1 0 0 1 0. 1 Difference No Carry means result is positive (110010.11)2 = (50.75)10 (93.5)10 - (42.75)10 = (50.75)10 Q. 5 . Perform binary addition 1. 1100111 + 101101 2. 110101 + 10100 3. 10101 + 11101 4. 1101+1010 5. 11001011 + 1001 1101 Ans.: 1. 1100111 + 101101 11111 110111 Augend + 1 0 1 1 0 1 Addend 1 1 0 0 1 0 0 Sum 2. 110101 + 10100 11 Carry 110101 Augend + 10100 Addend Sum 1001001 CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 15 3. 10101 + 11101 11 1 Carry 1 0 1 0 1 Augend + 1 1 1 0 1 Addend 1 1 0 0 1 0 Sum 4. 1101 + 1010 11 Carry 1 1 0 1 Augend + 1 0 1 0 1 Addend 1 0 0 1 0 Sum 5. 11001011 + 1001 1101 11 1 1 1 Carry 1 1 0 0 1 0 1 1 Augend + 1 0 0 1 1 1 0 1 Addend 1 0 1 1 0 1 0 0 0 Sum 1.9 Summary A numeral system (or system of numeration) is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner. The number the numeral represents is called its value. A numeral system (or system of numeration) is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner. The same sequence of symbols may represent different numbers in different numeral systems. For example, “11” represents the number eleven in the decimal numeral system (used in common life), the number three in the binary numeral system (used in computers), and the number two in the unary numeral system (e.g., used in tallying scores). The number the numeral represents is called its value. CU IDOL SELF LEARNING MATERIAL (SLM)

16 Digital Circuits and Logic Designs 1.10 Key Words/Abbreviations  Augend: the number to which another is added.  Addend: a number which is added to another. 1.11 Learning Activity 1. Explain Decimal Number System. ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- 2. Convert following binary number to 1’s complement. (i) (1101)2 (ii) (1011)2 ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- 1.12 Unit End Questions (MCQ and Descriptive) A. Descriptive Types Questions 1. Define number system. 2. Define binary operations. 3. Explain coding. 4. Describe binary arithmetic with suitable examples. B. Multiple Choice/Objective Type Questions 1. 1's complement of binary number 110010 is : (a) 001101 (b) 000001 (c) 11110 (d) 1110000 CU IDOL SELF LEARNING MATERIAL (SLM)

Introduction to Number System 17 2. 2’s complement of 01000 is: (a) 1110 (b) 11000 (c) 11111 (d) 1111 3. The binary value of 7: (a) 1111 (b) 11110 (c) 0111 (d) 1100 4. Convert Binary 1011 into its Hexadecimal equivalent : (a) A (b) E (c) C (d) B 5. Octal equivalent 011 is: (a) 3 (b) 4 (c) 5 (d) 7 Answers 1. (a), 2. (b), 3. (c), 4. (d), 5. (a) 1.13 References 1. https://www.google.com/search?sxsrf=ACYBGNSzu9LDJK90b1a2ZBuamALxZDv bUg:1575968343009&q=binary+number+system&sa=X&ved=2ahUKEwjnnIzK26rmAh UTU30KHW0-DooQ1QIoBXoECA0QBg&biw=1360&bih=657 2. https://www.google.com/search?sxsrf=ACYBGNSzu9LDJK90b1a2ZBuamALxZDv bUg:1575968343009&q=types+of+number+systems&sa=X&ved=2ahUKEwjnnIzK26r mAhUTU30KHW0-DooQ1QIoAHoECA0QAQ&biw=1360&bih=657  CU IDOL SELF LEARNING MATERIAL (SLM)

UNIT 2 NUMBER SYSTEM Structure: 2.0 Learning Objectives 2.1 Introduction 2.2 Inter-conversions of Number System 2.3 Digital Codes: 2.3.1 Binary Coded Decimal 2.3.2 Gray Code 2.3.3 Excess-3 Code (XS-3) 2.3.4 ASCII Code 2.4 Summary 2.5 Key Words/Abbreviations 2.6 Learning Activity 2.7 Unit End Questions (MCQ and Descriptive) 2.8 References 2.0 Learning Objectives After studying this unit, you will be able to:  Describe binary number system conversion  Explain various codes CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 19 2.1 Introduction Computers and other digital circuits process data in binary format. Various binary codes are used to represent numbers, alphabets or special characters. In coding, when numbers, letters or special characters are represented by a specific group of symbols, it is said that the number, letter or special characters being encoded and group of symbols is called as a code. The number based conversions are essential in digital electronics..mostly in all digital system, we have the input in decimal format..but it takes as binary number for the computation by decimal to binary conversion..and we use the hexadecimal number to make coding for microprocessor but it converts that to binary for computation after the computation the result will be in hexadecimal format by inverse conversion. 2.2 Inter-conversions of Number System (A) Conversion from Any System to Decimal Number To convert a decimal number to binary, octal and hexadecimal numbers. In this number is to continually divide the number by its radix and with each division, write down the remainder. When read from bottom to top, the remainder will be the converted result. (I) Decimal to Binary Numbers Example 1: Convert the decimal number 1310 to binary numbers. Solution: Divide 1310 by the system radix 2, which converting to binary. Therefore, 1310= 11012 Example 2: Convert decimal number 29 to binary numbers. Solution: Calculating binary equivalent numbers. Operation Result Remainder 29/2 14 1 14/2 7 0 7/2 3 1 3/2 1 1 1/2 0 1 CU IDOL SELF LEARNING MATERIAL (SLM)

20 Digital Circuits and Logic Designs The remainders have to be arranged in the reverse order so that the first remainder becomes the least significant digit (lsd) and the last remainder becomes the most significant digit (msd). Therefore, 2910= 111012. (II) Octal To Decimal Conversion The system radix of octal is 8, since any of the 8 values from 0 to 7 can be written as a single digit. Example 1: Convert 1268 to decimal numbers. Solution: Using the values of each column, (which in an octal integer are powers of 8) 1268 = (1 × 82) + (2 × 81) + (6 × 80) = 1 × 64 + 2 × 8 + 6 × 1 = 64 + 16 + 6 = 86 Therefore, 1268 = 8610. Example 2 : Convert octal number 12570 to decimal number. Solution: Calculating decimal equivalent numbers Octal number Decimal number 125708 ((1 × 84) + (2 × 83) + (5 × 82) + (7 × 81) + (0 × 80))10 125708 (4096 + 1024 + 320 + 56 + 0)10 125708 549610 Therefore, 125708 = 549610 (III) Hexadecimal to Decimal Numbers Example 1: Convert b2d16 to decimal numbers. Solution: Calculating decimal equivalent numbers b2d16 = (b × 162) + (2 ×161) + (d × 160) = (11 × 162) + (2 × 161) + (13× 160) CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 21 = 2816 + 32 +13 = 286110 Therefore, b2d16 = 286110. (B) Conversion from Any System to Decimal Number To convert a decimal number to binary, octal and hexadecimal numbers. In this number is to continually divide the number by its radix and with each division, write down the remainder. When read from bottom to top, the remainder will be the converted result. (I) Decimal to Binary Numbers Example 1: Convert the decimal number 1310 to binary numbers. Solution: Divide 1310 by the system radix 2, which converting to binary. Therefore, 1310= 11012 Example 2: Convert decimal number 29 to binary number. Solution: Calculating binary equivalent numbers. Operation Result Remainder 29/2 14 1 14/2 7 0 7/2 3 1 3/2 1 1 1/2 0 1 CU IDOL SELF LEARNING MATERIAL (SLM)

22 Digital Circuits and Logic Designs The remainders have to be arranged in the reverse order so that the first remainder becomes the least significant digit and the last remainder becomes the most significant digit Therefore, 2910= 111012. (II) Decimal to Octal Numbers Example 1: Convert the decimal number 8610to octal numbers. Solution: Divide 8610 by the system radix, which when converting to octal is 8. This gives the answer 10, with a remainder of 6. Continue dividing the answer by 8 and writing down the remainder until the answer is 0 Therefore, 8610= 126 Example 2: Convert decimal number 25 to octal number. Solution: Calculating decimal equivalent numbers. Operation Result Remainder 1 25/8 3 3 3/8 0 Therefore, equivalent number is 2510 = 318 (III) Decimal to Hexadecimal Numbers Example 1: Convert decimal numbers 286110 to hexadecimal numbers. Solution: Divide 286110 by the system radix 16. As some of the remainders may be greater than 9 and so require their alphabetic replacement and then convert them to hexadecimal. CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 23 Therefore, 286110= b2d16 Example 2: Convert decimal number 2479 to hexadecimal number. Operation Result Remainder Equivalent remainder 2479/16 154 15 F 154/16 9 10 A 9/16 0 9 9 Binary number into decimal, every binary bit is multiplied by 2’s power from right to left before decimal point, finally all the values are added to get the decimal equivalent. For fraction, the bit is multiplied by 2-n where, n is position of bit from left to right. Example : (110101.0111)2 = (?)10 = (1 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20) + (0 × 2-1 + 1 × 2-2 + 1 × 2-3 + 1 × 2-4) = (32 + 16 + 0 + 4 + 0 + 1) + (0 + 0.25 + 0.125 + 0.0625) = (53.4375)10 (C) Conversion of Binary Number System to Other Number System (I) Binary to Decimal Conversion To convert any binary number into decimal, every binary bit is multiplied by 2’s power from right to left before decimal point, finally all the values are added to get the decimal equivalent. for fraction, the bit is multiplied by 2-n where, n is position of bit from left to right. Example : (110101.0111)2 = (?)10 = (1 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20) + (0 × 2-1 + 1 × 2-2 + 1 × 2-3 + 1 × 2-4) = (32 + 16 + 0 + 4 + 0 + 1) + (0 + 0.25 + 0.125 + 0.0625) = (53.4375)10 CU IDOL SELF LEARNING MATERIAL (SLM)

24 Digital Circuits and Logic Designs (II) Binary to Octal Conversion Binary to octal conversion can be done by forming a group of three bits starting at the binary and then converting. Each group of three bits to its octal equivalent. O’s are added at each end if necessary. Example: (11.01)2 = (?)8 = (32)8 (11.01)2 = (32)8 (III) Binary to Hexadecimal System. Binary to hexadecimal conversion can be done by forming a group of four bits starting at the binary and they converting each group of four bits to its hexadecimal equivalent 0’s are added at each end if necessary. Example: (110110 . 011101)2 = (?)16 = (00110110 . 01110100)2 = (36.74)16 (110110 . 011101)2 = (36.74)16 (C) Conversion of Octal Number System to Other Number System (I) Octal to Binary Conversion Octal to binary conversion can be done by writing these digits binary equivalent to each octal digit and then combining all the resulting bits into a single binary number. Example: (125)8 = (?)2 = 1 (001) = 2 (010) = 5 (101) (125)8 = (001 010 101)2 CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 25 (II) Octal to Hexadecimal Conversion Octal to hexadecimal conversion can be done by first convert octal number into binary number by writing its 3 bit binary equivalent. Then binary number convert into hexadecimal number by making it 4bit binary equivalent. Example: (273.45)8 = (?)16 (273.45)8 = (?)2 (273.45)8 = (010111011.100101)2 Now make group of 4 bit and write its hexadecimal equivalent = (000010111011 . 10010100)2 = (?)16 = (0 bb. 94)16 (010111011 . 100101)2 = (0bb.94)16 Therefore, (273.45)8 = (0bb.94)16 (C) Conversion of Hexadecimal Number System to Other Number System I. Hexadecimal to Binary Conversion Hexadecimal to binary conversion can be done by writing four digits binary equivalent to each hexadecimal digit and then combining all the resulting bits into a single binary number. The table given below shows the basic hexadecimal digits and equivalent binary number. Example: (25c. 3af)16 = (?)2 (25c.3af)16 (001001011100. 001110101111)2 II. Hexadecimal to Octal Conversion Hexadecimal to octal conversion can be done by first convert hexadecimal number into binary number, write its 4 bit binary equivalent, then binary number converted into octal number, group 3 bit binary and write its hexadecimal equivalent. CU IDOL SELF LEARNING MATERIAL (SLM)

26 Digital Circuits and Logic Designs Example: (fe9.37d)16 (?)8 (fe9.37d)16 = (?)2 (fe9.37d)16 = (111111101001. 001101111101)2 2.3 Digital Codes Introduction to Digital Code Computers and other digital circuits process data in binary format. Various binary codes are used to represent numbers, alphabets or special characters. In coding, when numbers, letters or special characters are represented by a specific group of symbols, it is said that the number, letter or special characters being encoded and group of symbols is called as a code. For example, 1000001 in binary is 65 in decimal, 41 in BCD and alphabet A in ASCII. Classification of Codes Digital data is represented, stored and transmitted as groups of binary digits also known as binary code. The binary codes can be classified as shown in Fig. Binary code Non weighted code Reflective code Sequential code Error detecting and correcting code Weighted code  Example:  Example:  Example: Gray 5211 8421  Example: Excess-3 Hamming Excess-3 2421 Parity Excess-3 Five bit BCD Binary  BCD Ex: 0s1 Ex: 8421 2421 5211 4221 Fig. 2.1: Classification of Codes CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 27 2.3.1 BCD Code BCD numbers are binary coded decimal numbers. In BCD each decimal digit is represented by its 4 bit equivalent binary number. The four-bit BCD code for decimal number 0 to 9 is shown below: Table 2.1: BCD Code Decimal Binary Decimal Binary 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001 Numbers larger than 9, having two or more digits in the decimal system, are expressed digit by digit. For example, the BCD code of decimal number 185 is 0001 1000 0101 The binary equivalents of 1, 8 and 5, always in a four-digit format, go from left to right. The BCD representation of a number is not the same as its binary representation. For example, in binary form, the decimal number 185 represented as 10111001 The BCD system offers relative ease of conversion between machine-readable and human- readable numerals that is decimal to binary. As compared to the simple binary system, however, BCD increases the circuit complexity. The BCD system is not as widely used today as it was a few decades ago, although some systems still employ BCD in financial applications. (a) BCD Addition The BCD addition rules are given below in the steps with an example. 1. At first the given number are to be added using the rule of binary. CU IDOL SELF LEARNING MATERIAL (SLM)

28 Digital Circuits and Logic Designs 2. If result of addition of two binary number is greater than 9, which is not valid for BCD number and if result of addition of two number is less than 9, which is valid for BCD numbers. 3. If the four bit result of addition is greater than 9 and if a carry bit is present in the result then it is invalid and we have to add 6 whose binary equivalent is (0110)2 to the result of addition. For example (1111)2 + (0110)2 = 0001 0101 = 15 BCD Subtraction There are several methods of BCD Subtraction. BCD subtraction can be done by 1’s compliment method and 9’s compliment method or 10’s compliment method. (b) BCD Subtraction Subtraction by 1’s compliment method, the following steps are used 1. At first 1’s compliment of the subtrahend is done. 2. Then the complimented subtrahend is added to the other number from which the subtraction is to be done. This is called adder 1. 3. Now in BCD Subtraction there is a term ‘EAC (end-around-carry) ’. If there is a carry, i.e., if EAC = 1, the result of the subtraction is +ve and if EAC = 0 then the result is –ve. 4. In the final result, if any carry bit occurs, then it will be ignored. Example 1: The number 0010 0001 0110 is subtracted from 0101 0100 0001.  At first 1’s compliment of the subtrahend is done, which is 1101 1110 1001 and is added to 0101 0100 0001. This step is called adder 1.  Now after addition if any carry occurs then it will be added to the next group of numbers towards MSB. Then EAC will be examined. Here, EAC = 1. So, the result of addition is positive and true result of adder 1 will be transferred to adder 2.  There are three groups of four bit numbers. 1010 is added 1011 which is the first group of numbers because it do not have any carry. The result of the addition is the final answer. CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 29  Carry 1 will be ignored as it is from the rule.  Now, move to the next group of numbers. 0000 is added to 0010 and gives the result 0010. It is the final result again.  Now again, move to the next group here 0000 is also added to 0011 to give the final result 0011.  In these two groups, 0000 is added, because result of first adder do not contain any carry. Thus, the results of the adder 2 is the final result of BCD Subtraction. (0101 0100 0001) – (0010 0001 0110) = (0011 0010 0101) (0101 0100 0001) = (541)10 (0010 0001 0110) = 21610 (0011 010 0101) = 32510 Therefore, we know that 541 − 216 = 325, Thus we can say that our result of BCD Subtraction is correct. 2.3.2 Gray code Gray Code is one of the most important codes. It is a non-weighted code which belongs to a class of codes called minimum change codes. In this codes while traversing from one step to another step only one bit in the code group changes. In case of Gray Code, two adjacent code numbers differs from each other by only one bit. For example gray code of decimal number 6 is 0101 and 7 is 0100. These two codes differ by only one bit position ( at LSB). The idea of it can be cleared from the table given below. Table 2.2: Gray Code Decimal Binary Gray 0000 0 0000 0001 0011 1 0001 0010 0110 2 0010 3 0011 4 0100 CU IDOL SELF LEARNING MATERIAL (SLM)

30 Digital Circuits and Logic Designs 5 0101 0111 6 0110 0101 7 0111 0100 8 1000 1100 9 1001 1101 10 1010 1111 11 1011 1110 12 1100 1010 13 1101 1011 14 1110 1001 15 1111 1000 2.3.3 Excess -3 Code (XS-3) This is another form of BCD code in which each decimal digit is coded into a 4 bit binary code. It is non-weighted code which means it does not have fixed weight assigned to each bit position. To convert any decimal number to XS-3, add 3 to each decimal digit and then convert the sum to BCD form. For example, to convert 29 to an excess-3 number, first add 3 to each decimal digit 29 +33 5 12 Now, convert the sum to BCD form 5 12 0101 1100 The excess-3 code for all decimal digits is found by the same procedure. The entire code is shown in the following table: CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 31 Table 2.3: Excess-3 Code Decimal Binary XS-3 0 0000 0011 1 0001 0100 2 0010 0101 3 0011 0110 4 0100 0111 5 0101 1000 6 0110 1001 7 0111 1010 8 1000 1011 9 1001 1100 The key feature of excess-3 code is that it is self complimenting. It means that 1's compliment of excess-3 number is the excess-3 code for 9's compliment of the corresponding decimal number. The 9's compliment of a decimal number is found by subtracting each digit in the number from 9. For example, 9's compliment of 4 is 5. The excess-3 code for decimal number 4 is 0111. Its 1's compliment is 1000 which is the excess-3 code for the decimal number 5 and 5 is 9's compliment of 4. Hence, it is called as self complimenting. (a) Excess -3 Code Addition The following steps should be used in Excess-3 Code Addition: Step 1: We have to convert the numbers (which are to be added) into excess-3 forms by adding 0011 with each of the four bit groups them or simply increasing them by 3. Step 2: Now, the two numbers are added using the basic laws of binary addition. Step 3: Now which of the four groups have produced a carry we have to add 0011 with them and subtract 0011 from the groups which have not produced a carry during the addition. CU IDOL SELF LEARNING MATERIAL (SLM)

32 Digital Circuits and Logic Designs Step 4: The result which we have obtained after this operation is in Excess-3 form and this is desired result For example, two numbers which we will to add. 0011 0101 0110 and 0101 0111 1001 are the two binary numbers. Now following the first step we take the excess-3 form of these two numbers which are 0110 1000 1001 and 1000 1010 1100, now these numbers are added following the basic rules of addition. Now adding 0011 to the groups which produces a carry and subtracting zero from the groups which did not produced carry we get the result as 1100 0110 1000 is the result of the addition in excess-3 code and the BCD answer is 1001 0011 0101. (b) Excess -3 Code Subtraction The following steps should be used in Excess-3 Code Subtraction Step 1: The given numbers have to be converted into excess-3 code. Step 2: The basic methods of binary subtraction. Step 3: Subtract ‘ 0011 ’ from each BCD four-bit group in the answer if the subtraction operation of the relevant four-bit groups required a borrow from the next higher adjacent four-bit group. Step 4: Add ‘0011’ to the remaining four-bit groups, if any, in the result. Step 5: Finally we get the desired result in excess-3 code. For example take the numbers 0001 1000 0101 and 0000 0000 1000 now the excess-3 equivalent of those numbers are 0100 1011 1000 and 0011 0011 1011 Now performing the operation of binary subtraction. Now, in the above mentioned operation, the least significant column which needed a borrow and the other two columns did not need borrow. Now, we have to subtract 0011 from the result of this column and add 0011 to the other two columns, we get 0100 1010 1010. This is the result expressed in excess-3 codes. And the binary result is 0001 0111 0111 CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 33 (b) Excess -3 Code Subtraction The following steps should be used in Excess-3 Code Subtraction: Step 1: The given numbers have to be converted into excess-3 code. Step 2: The basic methods of binary subtraction. Step 3: Subtract ‘0011’ from each BCD four-bit group in the answer if the subtraction operation of the relevant four-bit groups required a borrow from the next higher adjacent four-bit group. Step 4: Add ‘0011’ to the remaining four-bit groups, if any, in the result. Step 5: Finally we get the desired result in excess-3 code. For example, take the numbers 0001 1000 0101 and 0000 0000 1000 now the excess-3 equivalent of those numbers are 0100 1011 1000 and 0011 0011 1011 Now performing the operation of binary subtraction. Now, in the above mentioned operation, the least significant column which needed a borrow and the other two columns did not need borrow. Now, we have to subtract 0011 from the result of this column and add 0011 to the other two columns, we get 0100 1010 1010. This is the result expressed in excess-3 codes. And the binary result is 0001 0111 0111 2.3.4 ASCII Code When we enter any information in a computer we use letters, numbers or symbols, but computer understands only 0 and 1. Therefore, some kind of alphanumeric code is required to get information in and out of computer. Previously manufacturers used their own alphanumeric codes, which led to lot of confusion. Eventually industry decided on an input-output code known as American Standard Code for Information Interchange – ASCII (pronounced as “ask - ee”) This code allowed manufacturers to standardize computer hardware such as keyboard, printers and video displays. The ASCII code uses 7-bit code as shown in the table below. CU IDOL SELF LEARNING MATERIAL (SLM)

34 Digital Circuits and Logic Designs Table 2.4: ASCII Code The ASCII code of any letter, number or symbol is combination of row and column in which it is written. For example, the ASCII code of A is - 4116. Convert number in row that is 4 in this case in 3 bit binary form and number in column that is 1 in 4 bit binary form. Therefore, ASCII code of A is 100 0001 Similarly, a - 110 0001 $ - 010 0100 and so on Code Conversion (a) Binary to BCD Code Conversion Step 1 – Convert the binary number to decimal. CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 35 Step 2 – Convert decimal number to BCD by writing BCD equivalent of each decimal digit. For example 1. Convert (1011011)2 to BCD Step 1 – Convert the binary number to decimal. 1011011 26 25 24 23 22 21 20 64 + 32 + 16+ 8 + 4 + 2 + 1 = (91)10 Step 2 – Convert decimal number to BCD by writing BCD equivalent of each decimal digit. 9 in BCD is 1001 1 in BCD is 0001 Therefore, 91 in BCD is (10010001)BCD (1011011)2 = (10010001)BCD 2. Convert (10100010)2 to BCD. Step 1 – Convert the binary number to decimal 1010010 26 25 24 23 22 21 20 64 + 32 + 16 + 8 + 4 + 2 + 1 = (82)10 Step 2 – Convert decimal number to BCD by writing BCD equivalent of each decimal digit. 8 in BCD is 1000 2 in BCD is 0010 Therefore, 82 in BCD is (1000 0010)BCD (10100010)2 = (1000 0010)BCD CU IDOL SELF LEARNING MATERIAL (SLM)

36 Digital Circuits and Logic Designs (b) BCD to Binary Code Conversion Step 1 – Convert BCD number to decimal by writing decimal equivalent of each group of 4 bits starting from right. Step 2 – Convert decimal number to binary equivalent by using dabble dabble method. For example – Convert (00110101)BCD to binary. Step 1 – Convert BCD number to decimal by writing decimal equivalent of each group of 4 bits starting from right. Decimal equivalent of 0101 is 5 Decimal equivalent of 0011 is 3 Therefore, (00110101)BCD = (35)10 Step 2 – Convert decimal number to binary equivalent by using dabble dabble method. 17 1 LSB 81 40 20 10 0 1 MSB (35)10 = (100011)2 (00110101)BCD = (100011)2 1. Convert (1011000)BCD to binary. Step 1 – Convert BCD number to decimal by writing decimal equivalent of each group of 4 bits starting from right. CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 37 Decimal equivalent of 1000 is 8 Decimal equivalent of 101 is 5 Therefore, (1011000)BCD = (58)10 Step 2 – Convert decimal number to binary equivalent by using dabble dabble method. 29 0 LSB 14 1 70 31 11 0 1 MSB (35)10 = (111010)2 (1011000)BCD = (111010)2 (d) BCD to Excess -3 Code Conversion To convert BCD number to excess-3, add 0011 (310) to each group of 4 bits starting from right. For example – 1. Convert (00110101)BCD to XS-3. 11 1 1 1 Carry 0011 01 0 1 +0011 0 01 1 0110 1 00 0 Therefore, (00110101)BCD = (01101000)XS-3 CU IDOL SELF LEARNING MATERIAL (SLM)

38 Digital Circuits and Logic Designs (e) Excess -3 to BCD Code Conversion To convert Excess-3 number to BCD, subtract 0011 (310) from each group of 4 bits starting from right. For example – 1. Convert (10011010)XS3to BCD 1 1 11 1 0 0 1 1 0 1 0 Borrow - 0 0 1 1 0 01 1 0 1 1 0 0 11 1 Therefore (10011010) XS3 = (01100111)BCD (f) Gray to Binary Conversion 1. Copy the MSB of the given gray number as it is. 2. Add the MSB of binary to the next bit of gray code. Ignore the carry if any. 3. Continue till LSB of gray. For example 1. Convert gray code 1011 to binary. MSB LSB Gray Code 1 0 1 1 ++ + Binary Code 1 1 0 1 2. Convert gray code 0110 to binary. Gray code - 0 1 1 0 Binary code - 0 1 0 0 CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 39 (g) Binary to Gray Conversion 1. Copy the MSB of the given binary number as it is. 2. Add the MSB of gray with the next bit of gray code. Note down the sum and ignore the carry. 3. Continue till LSB of gray code. For example 1. Convert binary code 1011 to gray. MSB LSB Binary Code 1 0 1 1 ++ + Gray Code 1 1 1 0 2. Convert binary code 0111 to gray. Binary Code - 0 1 1 1 Gray Code - 0 1 0 0 Examples: 1. Convert the following decimal number into equivalent Excess-3 codes 1. (28)10 = (?)Excess-3 = (0101 1011) (28)10 = (01011011) Excess-3 2. (127)10 = (?) Excess-3 = (0100 0101 1010) (127)10 = (010001011010) Excess-3 3. (56)10 = (?)Excess -3 = (1000 1001) Excess - 3 CU IDOL SELF LEARNING MATERIAL (SLM)

40 Digital Circuits and Logic Designs 4. (37)10 = (0110 1010) Excess -3 5. (247.6)10= (0101 0111 1010 . 1001) Excess -3 2. Obtain Excess-3 code of following binary numbers. 1. (11011)2 2. (10001)2 Ans.: 1. (11011)2 =(?)Excess-3 = 11011 + 11 11110 (11011)2 = (11110)Excess-3 2. (10001)2 =(?)Excess-3 = 10001 + 11 10100 (10001)2 = (10100) 3. Convert gray code 0110 to binary Gray code – 0 1 1 0 Binary code – 0 1 0 0 4. Explain Excess-3 code in detail. This is another form of BCD code in which each decimal digit is coded into a 4 bit binary code. It is non-weighted code which means it does not have fixed weight assigned to each bit position. To convert any decimal number to Excess-3 add 3 to each decimal digit and then convert the sum to BCD form. For example, to convert 29 to an excess-3 number, first add 3 to each decimal digit. CU IDOL SELF LEARNING MATERIAL (SLM)

Number System 41 + 29 5 33 12 Now, convert the sum to BCD form 5 12 0101 1100 2.4 Summary We communicate with each other in a particular language made of letters or words. We normally type letters or words through keyboard of the computer, but computer does not understand the words and letters. Rather, those words and letters are translated into numbers. This means that computers understand only numbers. We know the decimal (base 10) system, and are very comfortable with performing operations using this system, it is also important for us to understand that the decimal system is not the only system in the world. By studying other number systems such as binary (base 2), quaternary (base 4), octal (base 8), hexadecimal (base 16) and so forth, we will gain a better understanding of how number systems work in general. Number systems are the technique to represent numbers in the computer system architecture, every value that you are saving or getting into/from computer memory has a defined number system. As Computer architecture supports following number systems so we need to study them and also need to know the conversion technique between them. 2.5 Key Words/Abbreviations  Radix: the base of a system of numeration.  LSB: least significant bit  MSB: most significant bit CU IDOL SELF LEARNING MATERIAL (SLM)

42 Digital Circuits and Logic Designs 2.6 Learning Activity 1. List at least 3 ice breaking activities that facilitate group sessions. ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- 2. Convert (17E.F6) hexadecimal to equivalent binary. ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- 3. Explain BCD codes. ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- 2.7 Unit End Questions (MCQ and Descriptive) A. Descriptive Types Questions 1. Describe binary number system conversion. 2. Explain various types of codes. B. Multiple Choice/Objective Type Questions 1. Gray code is __________. (a) non-weighted code (b) BCD (c) binary (d) reflective code 2. Encode the decimal number 46 to Gray code (a) 000000 (b) 111001 (c) 111100 (d) 1110 3. Convert 1110 gray to binary (a) 1110 (b) 1101 (c) 1011 (d) 1111 CU IDOL SELF LEARNING MATERIAL (SLM)


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook