0% found this document useful (0 votes)
1K views578 pages

Digital Electronics Book

Electronics

Uploaded by

Priya Perumal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
1K views578 pages

Digital Electronics Book

Electronics

Uploaded by

Priya Perumal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 578
eC rd aoe a Sc rel Sa aa ed Cg a : oe ane - aa va Tt aN Publications Pune’ | Digital Techniques CSS M.S, Software Systems (BITS Pilani) BE. Industrial Electronics Formerly Lecturer in Department of Electronics Engg. Vishwakarma Institute of Technology Pune Mrs. D. A. Godse BE. Industrial Electronics, M. E. (Computer) Assistant Professor in Bharati Vidyapeeth's ‘Women's College of Engineering Pune Price Rs. 285/- Visit us at: www.vtubooks.com @ Cast Technical Publications rune” LER LATED This one L703-HNK-FND@ fat Digital Techniques ISBN 9788184314014 All rights reserved with Technical Publications. No par of this book should be reproduced in any form, Electronic, Mechanical, Photocopy or any information storage and retrieval sysiem without prior permission in writing, from Technical Publications, Pune Published by = ‘Technical Publications Pune® ‘#1, Amit Residency, 412, Shaniwar Peth, Pune - 411 030, India. Printer : Alen DTPintes St.na. 10/3,Sinhaged Road, Pane = 411 041 S| Table of Contents Chapter 1 Number Systems : 1 1.1 Introduction’ 4 1.2 Decimal Number System. wins el iavase oe BE ois oe Bebo array ovat ys 1 1.3 Binary Number System .2 1.31 Binary Counting . 3 1.32 Binary o-Décimal Conrsion me ‘182i Sieamined Mitieds os i 13.2.2 Double Dabble Method... ss. 58 4 1.3.3 Fraction: 5 434 Mixed Numbers os 4.35 Decimal to Binary Conversion... ss 6 1.3.6 Fractional Decimal to Binary Conversion 8 3.7 Binary Aritimetic sailed vis aeloatnentnesiatenae. 1.38 Signed BiraryNumbers fH 1.3.9 2's Complement Arithmetic... eee : . se : 13 ‘a Oot NUNIDES Systene sia wis aes wreck eee hae ca a. 1.4.1 Octal to Decimal Conversion. ................... m ie Ao Rie ee ae ee ee 1.4.3 Mixed Numbers 41 1.46 Binary to Octal Conversion... 4.47 Octal to Binary Conversion... 1.4.8 Usefulness of Octal System 1.4.9 Octal Arithmetic... . wee 1.5 Hexadecimal Number System... .... . 1.5.4 Hexadecimal to Decimal Conversion. ACOH nee cin en eee i a a OM 1.5.3 Mixed Numbers. 24 mM to H i 1.56 Binary to Hexadecimal Conversion. 1.57 Hexadecimal to Binary Conversion. 41.5.8 Octal to Hexadecimal Conversion 1.5.9 Hexadecimal to Octal Conversion _. 4.7 Binary Division. . naterial Solved Examples Review Questions... .... un ee 43 University Questions»... .. sper seer Chapter2 Binary Codes 45 2.1 Introduction . Bei are ~ 45 2.2 Classification of Binary Codes. 45 2.2.4 Weighted Codes... . 45 2.2.2 Non Weighted Codes. 46 2.2.3 Refective Codes i AB DW Secunia Code oon a ata bbe ne, grea Un I 48 22.5Alphanumeric Codes... .... 2.2... 46 2.2.6 Error Detecting and Correcting Codes . . 46 2.3 BCD (8-4-2-1) 23.4 BCD Addition... . 2.4 Other 4-BitBCD Codes........... 24.12-4-2-1 Code A. 2.5 Excess-3 Code . Bhs 55 2.5.1 Exoess-3 Addition... 55 25.2Excass-3 Subtraction. 56 DiS ees oscars ee enema a Ine sacae aoc Es, 58° 26.1 Advantage of Gray Code erent th a) 26.2Gray-to-Binary Conversion... . gout sansa uses sonseearancbecesnarananaratun .. 60 2.6.3 Binary to Gray Conversion . 60 7 Five Bi 2.8 Biquinary Code... . . . 61 2.9 Alphanumeric Codes... . 62 PASC a a a I AD, BOZEBCDIC i AF PMH Cas a a 2.10 Indian Soript odes for Information interchange -ISCIl.......- 1... 67 a ac Unhprelly Oudelions: «a nc. Ss don ve nS oa sees a a em nm Chapter 3 "Error Detecting and Correcting Codes 72 GSS Nee 3.2 Coding Theory and Terminology... 1. ee eee 72 42.1 Definitions 2 2.2.2 Condition for Error Detection i 73 Sa :Pariy Bliss: ois con ove lew vo8 cis oie tes Son 8 we Os 73 (vil Copyrighted material 3.4 Block Parity . . ae eee bene Levee B.S Linear Block Codes... 8 3.5.1 Matrix Representation of Linear Block Codes. 3.5.2 Generalized Steps for Construction of Code . « 3.5.3 Decoding the Received Codewords 3.54 Enror Correction 26 Vinay) Cyclic Codess: wsciscer aes ea gS 3.7 Burst Code 3.8 Check-sums and Cyclic Redundancy Checks. 3.9 Hamming Code 3.9.1 Number of Party Bits. 339.2 Locations ofthe Paty Bits nthe Code 3.9.3 Assigning Values to Parity Bits... 3.94 Detecting and Correcting an Error . i University Questions ........ Chapter 4 Logic Gates and Boolean Algebra 93 4.2 Logical Operators... ..... xz 4.2.4 Logical Operator NOTINVERT. . .. . « 4.22 Logical Operator AND 4.23 Logical Operator OR . 4.3 Logic Gates . . 4.33 The OR Gate 4.34 The NAND Gate 4.35 The NOR Gate... .. 4.36 The Exclusive-OR Gate. . 4.37 The Exclusive-NOR Gate . beeen eee 4A Boolean Algebra... ............. 4.4.1 Logic Expressions , 4.42 Laws of Boolean Algebra . 4.4.3 Rules in Boolean Algebra . 4.44 Duality Theorem. ....... 4.45 DeMorgan's Theorems . . . 4.4 Reducing Boolean Expressions. 4,5 Universal Property 4.5.1 NAND Gate 4.52 NOR Gate. 4.6 Alternative Logic-Gate Representation | (iii) 4.7 Conversion of AND/OR/NOT Logic to NAND/NOR ‘Logic i 128 4.8 ANSI/NEEE Standard Logic Symbols. . . tie CIN EHS vw Z - + 133 Solved Examples. 136 Raview Questions 0 University Questions . . 147 Chapter 5 — Simplification of Boolean Functions 148 5.1 Introduction. ee 148 5.2 Representation of Logic Expressions _ . cee ee 148 5.2.1 Sum of Product Form... . capsreiae sees eae cee 49 5.2.2 Productof Sum Form... . . . 149 5.2.3 Standard SOP and POS Forms . ee 2 9 5.24 Cowvering Expressions in Standard SOP oF POS FOS see eee ee 5 150 5.2.5 Minterms and Maxterms . . . . 5.3 Simplification of Boolean Expressions 5.4 Algebraic Simplification 5.5 Karnaugh Map Simplification. . . 5.5.1 The Kamaugh Map 5.5.2 Plotting a Karnaugh Map . 5.5.3 Grouping Cells for Sinpliication : 554 Simplification of Sum of Products Expressions. . §.5.5 Exclusive-OR and Exclusive-NOR Functions 5.5.6 Dont Care Concitions. an 5.5.7 Simplification of Product of Sums Eiwessiia! 5.5.6 Five and Six Variable K-maps. . ‘5.5.8.1 Five Variable K-map . 5.58.2Six Variable K-map. . . se 5.6 Quine-McCluskey or Tabular Method | 5.7 NAND and NOR Implementation. 5.7.1 NAND-NAND Implementation. 5.7.2 NOR-NOR Implementation Review Questions University Questions 191 193 Chapter6 Logic Families 6.1 Introduction... . . . 6.2 Transistor as a Switch . 6.3 Definition of Parameters... . . ae see 6.3.1 Curent and Voltage Parameters ‘i 4 é = 252 2 ae asec - 253 6.3.3 Noise Margin... 2... feveeee vee : . » «253 6.3.4 Propagation Delay ....... Coo oe fore ee » 254 (i) 6.35 Power Dissipation . 255 6:36 Speed Power Product (Figure ofMett) seve e cece ee eee ST 6.4 Resistor - Transistor Logic (RTL)... ... . 257 6.4.1 RTL Circuit . 287 6.4.2 Circuit Operation beeen cree eee eee « 258 6.43 Speciicatons........ Oh & 14 AEs EG OUR ow) oa 2M 6.44 Wire-AND Comeciion . (4 OE TSS Te ten cis een DBD 6.5 Diode-Transistor Logic (DTL) bees woos Bek we eee 259 65.4 DTL Chou... ee 259 652 Cicuil Operation eee eee eee eee ee = 260 6.53 Specifications... . 2 Be Ba i A BAM ORD ae 261 6.5.4 Wire-AND connection . . e % ‘ 261 66TTL. . 261 6.6.1 Muliple-Enitter Transistor 6.6.2 TotemPole Output 6.633 Input and Output Currents-Fanout 6.64 Standard TTL Characteristics. . cece e eens 6.7 Improved TTL Series. . . wire woes. see : 6.7.1 High-Speed (H] and Low-Power (L) TTL... 22... Ligh GG Gia rye cere 6.7.2 The Schottxy Clamp. . . 2 aie 214 6.73 Schott (s) and Low-Power Scotty (LS) TTL < ve IB, 6.7.4 Advanced Schottky (AS) and Advanced Low-Power (ALS) Schottky TTL .......... . 276 6.75 Fast (F) TIL, : ‘ 277 6.7.6 Comparison of TTL Series Characteristics... . . ia os ee ot coe 6.8 Open Collector Outputs . . . 6.10 Comparison Between TOTEM Pole and Open Collector Output ..... . . 281 6.11 Tri-State Logic, Buffers and Bus Drivers........... . 281 6.12MOSFET Logic... 6. eee ee 613NMOS....... 6.13.41 NMOS Inverter... 6.13.2 NMOS NAND Gate . 287 6.13.3 NMOS NOR Gate . 287 6.14CMOS......5..0.. 269 6.14.1 CMOS: Inverter. . . 269 6.14.2 CMOS NAND Gate . . wee . was ses aes cen aces oll 6.14.3 CMOS NOR Gate cece es 292 6.14.4 Characteristics of CMOS... 2... eee fb none els teen anie 88 6.14.5 Buffered and Unbuffered Gates... . « i EH OE 2 296 6.14.6 Transmission Gates... eee ben eet oun mein S208 6.14.7 Open Drain Outpus..... 2... 298 6.14.8 High impedance Outputs. : . 299 6.14.9 Speciicatons and Standards... . . 300 &) 6.14.10 High Speed CMOS... . . bee ee eee ee 202 6.14.11 Comparison of CNOS. and TTL Fanales, . se see . . 302 6.15 Interfacing CMOS and TTL Devices . - 303 8.15.1 TTL Driving CMOS, . . 2 olan anteeES EG = 303 6.152 CMOS DrivngTL. «0... eee eee exeore oe NS 6.16 Dynamic MOS Logic........ 306 6.16.1 Dynamic MOS Inverter... .. . -- 07 6.162 Dynamic NOS NOR and NAND Gates aia Pie ria AR de ok 2 6.17 Emitter Coupled Logic... . . ¢ iu BEEN Hem Yee F xo e weg F180 6.17.1 ECL Characteristics . . . aoe i wie oes wt eee owe eee 6.17.2 Logic Levels in ECL ny bee . 310 6.17.3 Two Input ECL ORINOR Gate... see teen ene ee 80 6.17.4 Input and Output Characteristics... 6... eee ee MZ 6.17.5 Interfacing CMOS and TTL with ECL Gates * ve MD Review Questions ame sew wine University Questions. . 2 MG Chapter 7 _ Combinational Logic 316 7.4 Introduction... . « 316 7.2 Design Procedure . 316 7.3 Code Conversion. . . 318 7.3.1 Binary to BCD Converter . 7.3.2 BCD to Binary Converter . 7.3.3 BCD to Excess 3 . # 7.34 Exoess--3 to BCD Code Converter 7.3.5 Binary to Gray Code Converter . 7.3.6 Gray Code to Binary Code Converter. 7.3.1 BCD to Gray Code Converter. TAINS 6 og is cine concn eons 9, 7.4.4 Half-Adder. 7.4.2 Ful-Adder . 7.5 Subtractor 7.5.1 Half-Subtractor . 7.5.2 FultSubtractor gee Lae Pevanten’ys 76 n-Bit Parallel Adder ©... 2.2... .. 7.7 Look Ahead Carry Generator (Ic: 74182) . we 7.8 Binary Parallel Adder (IC 74LS83/74LS283). . . 7.9 n-Bit Parallel Subtractor... . . 7.10 Binary Adder-Subtractor. .. . . 7.11 BCD Adder... . . 7.12 BCD Subtractor . . teas 742498 Complement... eee 7.42.29's Complement Subtraction... 6... 353 7.42.3 10's Complement Subtraction 2. 354 TAS EROS DAMME! secs cose same & aed Dem maw vse BESS . . 357 7.14 Excess-3 Subtraction . 358 7.45 Digital Comparator... ee - 360 SONG EXAMPLE! ce choc cates woe w shame setae x ay wR Roe & o 364 Review Questions - 368 * University Questions 367 Chapter 8 — Combinational Logic with MSI and LSI 368 SA WRG con x cmcecmimis, eat WA ROR OR RRO me . » 368 8.2 Multiplexer . ee - 368 8.24 Boolean Functon Implementation an 8.2.2 Multiplexer ICs 2.379 8.3 Demultiplexer 2... eee - - 380 CADIORB cs wen x va a mae wae . 383 8.4.1 Boolean Function Implementation . . 384 8.42 Decoder IC 74138 385 8.4.3 Decoder IC 7442 2 388 8.5Encoder......... . 388 8.5.1 Priority Encoder 389 85.2 Encoder IC ( 74148). -. 304 8.6 BCD-To- 7 Segment Display Decoder/Driver 392 8.6.1 Basic Connection for Driving 7-Segment Displays 395 8.6.2 Seven Segment Decoder/Driver for LCD Display ~ 403 8.7 Parity Generator and Checker . . . 405 8.8BarCode....... 2 - 410 8.8.1 Structure of Bar Code . 4h 8.82 Types of Bar Codes at 8.83 Bar Code 39. 2 412 8.9 Bar Code Readers... 0.2... ee eee + + 413 8.10 Advantages of Bar Code. 413 8.11 Bar Code Applications . +. 414 8.12 Arithmetic Logic Unit (IC 74181). 415 Solved Examples... .. . 419 Review Questions. . . . » » 425 University Questions . . - 425 Chapter9 Flip-Flops , Registers and Counters 427 9.1 Introduction. - 427 9.2 Flip-Flops. - 428 (xii) 9.2.1 RS Flip-Flop 9.2.2 Clocked RS Flip-Flop 9.2.3 SR Flip-Flop. 9.2.4 Clocked SR Flip-Flop 9.2.50 FlipFlop . 9.2.6 JK Flip-Flop 92.7 TFlipFlop. .. .. . 9.2.8 Application of Flip-Flop . 9.3 Triggering of Flip-Flops .............08 * 9.3.1 Edge-Triggered Flip-Flop 9.3.2 Master-Slave Flip-Flop 9.3.3 Asynchronous or Direct Inputs . . bees 9.4 Flip-Flop Conversions... ...........-- 9.4.1 SR Flip-Flop to D Flip-Flop . 9.4.2 SR Fiip-Flop to JK Flip-Flop 914.3 SR Flip-Flop to T Flip-Flop 9.4.4 JK Flip-Flop to T Fp-Flop. . 9.4.5 JK Flip-Flop to D Flip-Flop 9.4.6 D Flip-Flop toT Flip-Flop 9.4.7 T Flip-Flop to D Flip-Flop 9.5Registers......... 9.5.1 Buffer Register . . 9.5.2 Shift Registers. . m 9.6 Applications of shift egies . 9.6.1 Delay Line... . . 9.6.2 Serial-to-Parallel Converter. 9.6.3 Parallel-to-Serial Converter. . . 9.6.4 Shift Register Counters 9.6.4.1 Ring Counter 9.6.4.2 The Johnson Counter or Twisted Ring Counter 9.6.5 Pseudo-Random Binary Sequence (PRBS) Generator. 9.7 Counters... . 9.7.1 Asynchronous i Ripple ‘Counters . 9.7.1.1 Propagation Delay in Ripple Counter. 9.7.1.2 Decoding Glitches . 9.1.2 Synchronous Countes....... 2... 973 Synciwonous Vs Asynchronous Counters. 9.8StateTable........... 9.9 Flip-Flop Excitation Tables. 9.9.1 RS Flip-Flop. . 9.9.2 JK Flip-Flop 9.9.3 D Flip-Flop . 9.9.4 Flip-Flop (xiii) 428 432 434 435 - 436 441 . 451 . 463 9.10 Design Procedure . woe . 484 9.11 Modulus N Synchronous Counter... aioe wen 484 9.12 MOD Counters Using Reset Input...........- sas ew ony BOT 9.13 UP / DOWN Synchronous Counters... .. 2.2... 2.00. eee es. 491 9.14 Typical ICs for Counters and Shift Registers... 1.2... ee ee ee 493 9.14.1 IC 7490 (Decade Binary Counter) : . cc 8 9114.2 IC 7492/93 (4-Bit Ripple Counters) s-eagetsertclasomene ease eater sates . 497 9.14.3 IC 74461 (4-Bit Synchronous Binary Counter). . oe ee) 914.4 1C 74491 507 4145 IC 7419274199 (UPIDONNSCDBINARY Counters)... : . 609 914.6 IC 74194 (Universal Shifi Register) eS elle des 38 es BY 9.45 Counter Applications. 0... cee ee eens see e eee ees 518 9.15.1 Digital Clock . 519 915.2 Frequency Counter... . scone <0 BD ‘SGWed Bcaiplen:. . os snes nee # coe coe Ome eee wee eRe ee 522 Review Questions. . aie anes wee ec KR ade Gone * me eR oe 537 Ui ge ee ee ee ee eo) 539 Chapter 10 Sequential Circuits 10.1 Introduction . 10.2 Synchronous or Clocked Sequential Circuits 10.2.1 Moore Ciruit. 10.2.2 Mealy Circuit. . . 10.2.3 Moore Vs Mealy Circuit Models 10.3 Analysis of Clocked Sequential Circuits ......... 10.3.1 State Table. 10.3.2 State Diagram 10.3.3 State Equatons 10.4 State Reduction. 10.5 State Assignment. . . 10.6 Flip-Flop Excitation Tables 10.7 Design Procedure. . . . . 10.7.1 Design with Unused State... . . 10.7.2 Lockout Condition 10.8 Sequence Generator... ... snk 10.8.1 Sequence Generator Using Counters . 10.8.2 Sequence Generator Using Shift-Register. 10.9 Sequence Detector... . Solved Examples 28 a5 Review Questions . . . Z é Si 3 WS A EERE oe BIB University Questions... 2. ee 618 (xiv) Chapter11 Semiconductor Memories 619 11.1 Introduction . . - 619 11.2 Terminology and Operations . . 619 11.3 Types of Semiconductor Memories. . - 620 11.4 ROM ( Read Only Memory). . . . * ion ve OO 11.4.1 ROM and its Architecture . . . cre a ate saeseeeas 620 114.2 PROM (Programmable Read Only Memory). . cece eee cece ee 62 11.4.3 EPROM ( Erasable Programmable Read Only Memory)... . cece ee 62 11444 EEPROM (Electical Erasable Programmable Read Only Memory)... 623 11.4.5 NVRAM 11.4.6 Flash Memory 11.5 RAM andiits Architecture... . 11.5.4 Static RAM. . 11.5.1. TTLRAM Call 11,5.1.2 MOS Static RAM Cell... 115.2 Dynamic RAM 1.5.2.1 Write Operation 11.5.2.2 Read Operation 11,5.2.3 Refresh Operation 1153 Comparison Between SRAM and DRAM . 11.6 Memory Structure and its Requirements . 11.7 Standard Memory Chips... . . 11.7.1 Characteristics of Memory 417.2 Standard Memory Chis 11.7.3 Memory Cycles 11.8 Typical Memory ICs. . 11.8.1 IC 2764 (EPROM) 11.8.2 10 2114 (RAM). At BTL IEEE 11.9 Expanding Word Size... eee 11.10 Expanding Memory Capacity... .. . . 11.11 Charge-Coupled Devices (CCDs)... . 11.12 Magnetic Bubble Memory. . 11.13CD-ROM.... ‘ Review Questions University Questions . 631 Chapter 12 Programmable Logic Devices 42.1 Introduction... 2... 12.2 Read Only Memory (ROM) 122.4 Combination Logis Implementation Using ROM... 122.2 Types of ROMs . 7 © iv) 12.3 Programmable Logic Array (PLA). . .. 651 12.4 Programmable Array Logic (PAL). . . . 657 Review Questions .. . . . 665 University Questions. . . - 666 Chapter 13 Multivibrators 667 13.1 Introduction... . . . . 667 13.2 Types of Multivibrators . . 667 13.3 Bistable Multivibrator . 667 13.3.1 Transistorized Bistable Mul 669 13.3.2 TTL Bistable Multivibrator «670 13.4 Monostable Multivibrator ... 671 13.4.1 Nonretriggerable Monostable Multivibrator 671 134.2 Retriggerable Monostable Mulivibrator oe le eee O72 134.3 TTL Monostable Multvibrator.. ... « en 13.4.4 Applications of Monostable Multivibrator . 673 13.4.4.1 Frequency Divider 13.4.4.2 Missing Pulse Detector . 13.5 Astable Multivibrator......... ae 2 135.1 Transistorized Astable Multvibrator eee OB 135.2 TTL Astable Multvibrator 616 19.5.3 Applications . . 67 Review Questions... . .. 677 University Questions. . . . 677 Chapter 14 Clock Generator Circuits 678 14.1 Introduction... . “ am aie . . 678 14.2 Clock Waveform... 6.2... ee eee see es. 678 14.3 Clock Circuits. . . . . 678 443.1 Circuit1 . .. . 678 143.2 Circuit2 . . 679 143.3Cirouit3...... -. 681 University Question . . . . 682 Appendix A Typical Digital ICs 683 References S87 Index 588 evi) Number Systems 1.1 Introduction Number system is a basis for counting various items. On hearing the word ‘number’, all of us immediately think of the familiar decimal number system with its 10 digits : 0,1, 2, 3, 4,5, 6 7, Band9. Modern computers communicate and operate with binary numbers which use only the digits Oand 1. Let us consider decimal number 18. This numbers represented in binary as 10010. In the example, if decimal number is considered, we require only two digits to represent the number, whereas if binary number is considered we require five digits. Therefore we can say that, when decimal quantities are represented in the binary form, they take more digits. For large decimal numbers people have to deal with very large binary strings and therefore, they donot like working with binary numbers. This fact gave rise to three new number systems : Octal, Hexadecimal and Binary Coded Decimal (BCD). " These number systems represent binary number in a compressed form. Therefore, these number systems are now widely used to compress long strings of binary numbers. In this chapter, we discuss binary, octal, hexadecimal, and BCD number systems, and we will see how to convert from decimal to binary, octal and hexadecimal, and vice versa. In the later section of this chapter we are going to see binary arithmetic such as binary addition, subtraction, multiplication and division. 1.2 Decimal Number System Before considering any number system, let us consider familiar decimal number system. In decimal number system we can express any decimal number in units, tens, hundreds, thousands and so on. When we write a decimal number say, 5678.9, we know it can be represented as 5000 + 600 +70 + 8+ 0.9 = 56789 In power of 10, we can writeas 5x10 + 6x10 + 7x10) + 8x 10° + 9x10" Po ON De ee ee SX | 5678-9 q@) aa You have either reached a page that is unavailable for viewing or reached your viewing limit for this book. Digital Techniques. : Number Systems 1.3.1 Binary Counting We know that in decimal system we start at 0 and count upto 9 before we run out of digits. We then take another digit to the left and continue counting 10 through 99. We can carry on counting 100 through 999 by taking one more digit to the left. In the same fashion we can count binary numbers. But in binary numbers we have only two digits. We begin counting, 0,1. At this point we have used both digits, so we take another digit position and continue. Table 1.1 shows the binary numbers from 0000 to 1111 and its decimal equivalents. Decimal 1100 12. 1101 13. 1110 14 | aii 15 Table 1.1 Binary numbers 1.3.2 Binary-to-Decimal Conversion As mentioned earlier, binary number is a weighted number. It can be converted to its decimal equivalent simply by adding the products of each bit and its weight. There are two methods commonly used for converting a binary number to decimal. These are * Streamlined method * Double Dabble method Digital Techniques 4 Number Systems 1.3.2.4 Streamlined method We can streamline binary to decimal conversion by performing following steps : 1. Write the binary number 2. Directly under the binary number write 1,2, 4, 8, 16..., working from rightto left. 3. If digit is zero, cross out the decimal weight for that position. 4. Add the remaining weight to obtain the decimal equivalent of the binary number. Ex. 1.3: Convert binary number 1010 to its decimal equivalent. Sol. : Step 1: 1010 (number) Step 2:8 421 (Binary weights) Step3:8421 Step 4:8 +2=10,) Note: The subscript 10 identifies this as a decimal number. 1.3.2.2 Double Dabble Method A popular way to convert binary numbers to decimal numbers is the double dabble method. In this method, the conversion takes place in the following steps : 1. Multiply most significant digit (leftmost digit) by 2. 2. Add next adjacent digit to the result. 3. Multiply result by 2. 4. Add next adjacent digit to the result. 5, Repeat steps 3 and 4 until all the bits are over. Ex. 1.4: Convert binary number 10101 to its decimal equivalent. Sol.: 10101 * MsB 1sB Step1:1x2 =2 Step 2:2+0 Step 3:2x2 Step4:4+1 =5 Step 3:5x2 Step 4: 10+0 = 10 Step 3:10x2 =20 Step 4:20+1 =2l Digital Techniques Number Systems. 1.3.3 Fractions In the above section we have considered only binary integer numbers. In case of binary fraction numbers, we have to see the weights of digit positions to the right of the decimal point. These are given as 1/2, 1/4, 1/8, 1/16 and so on. In power of 2, the weights are 27,27, 2,24 and so on. These weights may be written in decimal form as 0.5, 0.25, 0.125, 0.0625 and so on. Ex. 1.5 Convert binary number .101 to its decimal equivalent. Sol. : Step1: 1 0 1 Step2: 0.5 0.25 0.125 Step3: 05 025 0.125 Step4: 0.5 +0+40.125 = 0.625 1.3.4 Mixed Numbers In general mixed numbers (numbers with an integer and a fractional part) can be represented as N=A, BY +A,.1 BY +...4A, BY +ApBO+A4 BT +AgB? +... where N= Number . B = Base or Radix Digit Digit number For binary numbers B = 2 and N=Ay, 2" +A,_12"") +...+A, 2) +Ag 2° +A, 27 +Ag 27 4+.. Following example shows how to get decimal equivalent from the above format. Ex. 1.6 Convert binary number 1 10 1 . 1 to its decimal equivalent. Sol.: N=1x 2° +1x2? + 0x2! +1x 2° +1x27 = 8+4+0+1+05 or = 13.519 Step1: 1 1 0 1.1 Step2: 8 4 2 1 05 Step3: 8 4 Z 1 05 Step4: 8 +4 +0+1+ 05 = 13.5, Review Questions 1. What is weight of the MSB (most significant Bit) of a 12-bit binary number ? 2. Convert each of the following binary numbers to decimal : (a) 1011, (b) 1001001, (c)10110.00101, Digital Techniques Number Systems. 1.3.5 Decimal to Binary Conversion Converting a decimal number to its binary equivalent is exact reverse the process described in the previous section. In the conversion process we have to first represent the number in the sum of power of 2, and then it is necessary to write 1s and 0s in the appropriate digit position. There are two ways of converting from a decimal number to a binary number. These are: + Sum-of Weights Method * Repeated Division by 2 Method Sum-of-Weights Method One way to find the binary number equivalent to a given decimal number is to determine the set of binary weights values whose sum is equal to the decimal number. This is illustrated in the examples 1.7, 1.8. Ex. 1.7: Convert decimal 10 to its binary equivalent. Sol.: 10= 8+4+2+1 (Binary weights) = 1.0 1 0 (Binarynumber) = 101.0, Note : The subscript 2 identifies this as a binary number. Ex. 1.8 : Convert following decimal numbers to binary (a) 23 (b) 37 (c) 61 (d) 94 Sol. : (a) 23, =16+8+4+2+1 310111, (b) 374) =32416 +8 444241 100101, (©) Gly =32+16+8+44+2 +1 3111101, (d) 44) =64492+164+84+4+2+1 1011110, Repeated Division by 2 or Double Dabble Method In this method we progressively divide the decimal number by 2 until quotient is zero and writing down the remainder after each division. The remainders are taken in the reverse order to form the binary number. This means that the first remainder is the least significant bit (LSB) and the last remainder is the most significant bit (MSB). This is illustrated in the examples 1.9 and 1.10. Digital Technic Number Systems Ex. 1.9: Convert decimal number 14 to its binary equivalent. Sol.: 1 Remainde Step 1: Divide 14 by2 2)IE SN a4 0 —+[o] usp 3 ‘Step 2: Divide Tby2 2) 7 2 6 1 1 Step3: Divide3by2 2J3_ mm 2 2 tT — 0 Step 4: Divide lby2 2) 1 0 rT —|1] msp Binary equivalent= 11107 Ex. 1.10 :Convert decimal number 37 to its binary equivalent. Sol. Remainder Step: Divide 37by2 237 36 T —+ [i] 1s 9 Step2: Divide 18by2 21 18 oo 2 4 Step3: Divide 9oy2 2) 2 i pr ; 2 Step4: Divided by2 a 2 o— 7 1 StepS: Divide2by2 2) 3 7 ° Steps Divide iy? aT > —[1} mse Binary equivalent = 100101, LsB MSB) Digital Techniques 8 Number Systems. Review Questions 1. Convert 674, to binary using both methods. 2. Convert 813, 10 binary using both methods and check your answer by converting back to decimal. 1.3.6 Fractional Decimal to Binary Conversion In case of fractional decimal numbers, numbers are multiplied by 2 and carries are recorded from the integer position. These carries when read downward represent binary equivalent to fractional decimal number. This means that the first carry produced is the MSB and the last carry produced is the LSB. Ex. 1.11: Convert 0.8125 decimal number to its binary equivalent. Sol. : Fraction Base Result Recorded Carries 0.8125 x 2 = 1.625 = 0.625 with a carry of 1 MSB 0625 x 2 = 125 = 0.25 witha carry of 1 025 «2 += 05 = 05 witha carry of 0 05 x 2 = 10 = 0.0 witha carry of 1 LSB Reading carries downward we get, binary fraction = 0.1101, which is equivalent to 0.8125 decimal. Ex. 1.12 : Convert 0.95 decimal number to its binary equivalent Sols Fraction Base —_ Result Recorded Carries 095 x 2 =19 = 09 withacarry of 1 MSB 09 x 2 = 18 = 08 witha carry of 1 os x 2 = 16 = 06 witha carry of 1 0.6 x 2 = 12 = 02 withacarry of 1 02 x 2 = 04 = 04 witha carry of 0 04 x 2 = 08 = 08 witha carry of 0 08 x2 16 0.6 witha carry of 1 LSB In this case, 0.8 is repeated a and if we multiply further, we will get repeated sequence. If we stop here, we get 7 binary digits, . 1111001. This answer is an approximate answer. To get more accurate answer we have to continue multiplying by 2 until we have as many digits as necessary for our application. ital Techniques Number Systems. Ex. 1.13: Convert decimal number 24.6 to a binary number Sol.: Step1: Separate integer part and fraction part Integer part : 24 Fractional part : 0.6 Step2: Find equivalent binary number for integer part 12 i Remainder Divide 24 by 2 2)24 -3 o— LSB 6 Divide 12 by 2 2jiz 12 ~o —+ 2 LSB 3 2 Divide 6 by 2 26 ab. 2 0 — 1 2 Divide 3 by 2 2y3" 2 1 —s 0 Divide 1 by 2 2yr. ‘ oO 1 z B a Binary equivalent of integer part = 11000, Step3: Find equivalent binary number for fractional part Fraction Base Result Recorded Carries 06 x2 = 12 = 02 withacarryof 1 MSB 02 «2 = 04 = 04 withacarryof 0 04 x2 = 08 = 08 withacarryof 0 08 x2 = 16 = 06 withacarryof 1 06 x2 = 12 = 02 withacarryof 1 LSB The binary equivalent number is 11000.10011. This number is an approximation of decimal 24.6, because we have terminated the conversion of fractional part after 5 digits. 40 stems, Review Questions 1. Convert each decimal number to binary. (a) 11.125 (6) 0.625 2. Convert each decimal number to binary by using the repeated division by 2 method for integers and repeated multiplication by 2 for fractions. (a) 578.3125 (b) 3015.8125 13.7 Binary Arithmetic Computer circuits do not process decimal numbers; they process binary numbers. In this section, we are going to learn binary arithmetic. Binary addition is the key to binary subtraction, multiplication, and division. So, let us see rules for binary addition. Rules for Binary Addition A B SUM CARRY O+0 0 0 O+1 1 0 1+ 0 1 0 141 0 1 Ex. 1.14: Add (1 0 1 0), and(0 01 1), Sol. : 1 «carry 1010 Decimal 10 +0011 + Decimal 3 1101 Decimal 13 Ex. 1.15 : Add 28 and 15 in binary Sol. : First we find the binary equivalent of 28 and 15. (1110 0), is a binary equivalent of 28 (1111), is a binary equivalent of 15 Digital Techniques 1 Number S} Addition of 28 and 15 11 «carry 11100 Decimal 28 DED E F Decimal 15 101011 Decimal 43 Rules for Binary subtraction A B Diff Borrow o-o0 o 0 [Osea 1 1 | 1-0 1 0 1-1 o 0 Ex. 1.16: Subtract (0 10-1), from(1 011), Sol.: 1 «< borrow 1011 Decimal 11 -0101 Decimal 5 0110 Decimal 6 1.3.8 Signed Binary Numbers Until now we have considered only unsigned numbers;numbers without any positive or negative sign. These unsigned numbers represent only magnitude. In this section we are going to see signed binary numbers. These numbers are represented by the sign magnitude format. Fig. 1.3 shows the sign magnitude format for 8 bit signed number. 87 B6 BS B4 B3 B2 BI BO LELLT TTT) Sign Magnitude Fig. 1.3 Here, the most significant bit (MSB) represents sign of the number. If MSB is 1,number is negative and if MSB is 0, number is positive. The remaining bits represent magnitude of the number. Here are some examples of sign-magnitude numbers. 1) +6 = 00000110 2) -14 1000 1110 3) +24 0001 1000 4) -64 = 11000000 jital Techniques 42 Number Systems. In case of unsigned 8-bit binary numbers the decimal range is 0 to 255. For signed magnitude 8-bit binary numbers the largest magnitude is reduced from 255 to 127 because we need to represent both positive and negative numbers. Maximum positive number ‘O11 1111 = +127 Maximum negative number 1111 1111 = -128 1’s complement Representation ‘The 1's complement of a binary number is the number that results when we change all 1's to zeros and the zeros to ones. Ex. 1.17 : Find 1's complement of (1 1 0 1)2 Sol. : 1101 number 0010 1'’scomplement Ex. 1.18: Find 1’s complement of 1011 1001 Sol. : 10111001 number 01000110 1's complement 2's Complement Representation The 2's complement is the binary number that results when we add 1 to the 1's complement. It is given as 2scomplement = 1’scomplement +1 The 2's complement form is used to represent negative numbers. Ex, 1.19 : Find 2's complement of (1 0 0 1), Sol.: 1001 number 0110 1’scomplement + 1 0111 2’scomplement _ Ex. 1.20 : Find 2’s complement of (1010 0011), Sol. : 10100011 number 01011100 1's complement + 1 01011101 2's complement Digital Techniques 13 Number Systems 1.3.9 2’s Complement Arithmetic For Addition :When we add two signed binary numbers there are four possible cases : both numbers positive, a positive number and a smaller negative number, a negative number anda smaller positive number, and both numbers negative. Let us see all the four cases. CASE1: Both Positive Ex. 1.21: Add 53 with 44 Sol. : Age 1 «© carry 0011 0101 (decimal 53) +0010 1100 (decimal 44) 0110 0001 (decimal 97) Here, bit by bit addition produces binary answer (0 1 1 0 0 0 0 1), which matches with the decimal addition. CASE2: Positive and smaller negative Ex. 1.22: Add 120 with -55 Sol. : 120 decimal (01111000), SSdecimal = (00110111), 1's complement of 55 = 11001000 2's complement of 55 = 11001001 Addition : 1111 120. 0111 1000 (decimal 120) + + (-55) 1100 1001 (2’scomplement of 55) 65 (0100 0001 (Decimal 65) Here, 2's complement number of the negative number is added in the positive number. The result is 65, which matches with the decimal addition. CASE3: Positive and large negative Ex. 1.23 : Add 32 and -50 Sol.: 32decimal = 00100000 50 decimal = 00110010 1's complement of 50 = 11001101 2's complement of 50 = 11001110 Digital Techniq 14 Number Systems. Addition : 32. 00100000 (decimal 32) toot (-50) 11001110 (2's complement of 50) =18 11101110 — (2's complement of 18) In this case, answer we get is in the 2’s complement form. 1 < Borrow 11101110 2's complement - 1 11101101 —_1’s complement 00010010 —number=18 CASE4: Both negative Ex. 1.24 : Add -30 and ~20 Sol. : In 2’s complement representation numbers are 00011110 (decimal 30 ) 11100001 1's complement + - 11100010 2's complement 2.2's complement of 20 = 11101100 Addition : 11 © carry (30) 11100020 + + (20) 11101100 50 = @11001110 2's complement of 50 We ignore final carry i.e. carry after 8th because itis meaningless in 8 bitaddition. The remaining 8-bits give answer in 2’s complement form 1 © borrow 11001110 2's complement - 1 11001101 1's complement 00110010 binary number = 50 For subtraction : When we subtract two signed binary numbers there are four possible cases : both numbers positive, a positive number and a smaller negative number, a negative number and a smaller positive number, and both numbers negative. Like addition, here also negative numbers are represented by their 2's complement equivalents. Digital Technique: 15, Number Systems. CASE 1: Both Positive Ex, 1.25 : Subtract 18 from 52 Sol. : 5252 - + 18 (-18) 34 34 2's complement of 18 0001 0010 decimal 18 11101101 1’scomplement 1 + 1110 1110 2's complement Addition : 11111 € carry 00110100 decimal 52 +11101110 2's complement of 18 @ 0010 0010 decimal 34 In 8-bit addition carry after 8th bit is ignored. After addition of 52'decimal and 2's complement of 18 we get result(0 0 1 0 0 0 1 0); , which is equivalent to decimal 34 and our answer is verified. CASE2: Positive and small negative Ex. 1.26 : Subtract (-12) from 48 Sol. 8 48 - st (az) 12 6 | 6 0011 0000 — decimal 48 0000 1100 — decimal 12 O01T 1100 — decimal 60 CASE3: Positive and large negative . Ex. 1.27 : Subtract -50 from +12 Sol.: 2 12 os ee (50) 50 62 0000 1100 decimal 12 + 0011 0010 decimal 50 0011 1110 decimal 62 Digital Techniques 16 Number Systems CASE4: — Both negative Ex. 1.28: Subtract -68 from - 15 Sol. : (-15) (15) at (68) 68 53 53. 2's complement of 15 00001111 number 11110000 1’scomplement + 1 11110001 2’s complement Addition : 1 + cary 11110001 2's complement of 15 . +01000100 decimal 68 @00110101 decimal 53 In 8-bit addition carry after 8th bit is ignored. After addition of 2’s complement of 15 (1111 0 0 0 1)and 68 we getresult(0 0 11 0 1 0 1), whichis equivalent to decimal 53 and our answer is verified. Review Questions 1, Determine the 1's complement of each tinary number. (a) 10011, @ 111011, ()10001, 2. Determine the 2's complement of each binary number. (a) 100, (b) 10000, (o)111001, 3. Perform the following subtraction using the 2's complement method. (a) 111011, ~101001, (b) 100111, ~100010, 1.4 Octal Numbers System We know that the base of the decimal number system is 10 because it uses the digits 0 to 9, and the base of binary number system is 2 because it uses digits 0 and 1. The octal number system uses first eight digits of decimal number system : 0, 1,2, 3, 4,5, 6, and 7. As it uses 8 digits, its base is 8. When we write an octal number say, 567, it can be represented in power of 8 as, 5x8) + 6x8! + 7x8 S28; FOES, © ERB, ital Techniques 17 Number Systems = 5x64 + 6x8+7x1 = 320+48+7 7510 1.4.1 Octal to Decimal Conversion The octal number can be converted into decimal number using following steps. 1. Multiply most significant digit (leftmost digit) by 8. 2. Add next adjacent digit to the result 3. Multiply result by 8 4, Add next adjacent digit to the result 5. Repeat steps 3 and 4 until all the digits are over. Ex. 1.29: Convert octal number 714 , to its decimal equivalent Sol: Step 1: 7x8 = 56 Step 2: 56+1=57 Step 3: 57x8=456 Step 4: 456+ 4= 460 decimal 1.4.2 Fractions In the above section we have considered only octal integer numbers. In case of octal fraction numbers, we have to see the weights of digit positions to the right of the decimal point. These are given as 1/8, 1/64, 1/512 and so on. In power of 8, the weights are 87,87, 8", 8* and so on. These weights may be written in decimal form as 0.125, 0.015625, 1.95312 x 10° and so on. Ex. 1.30: Convert octal number 0.512 to its decimal equivalent Sol.: 0512, =5x87+ 1x8? + 2x8? .625 + 0.015625 + 3.90625 x 10 6445312 ° 1.4.3 Mixed Numbers In general mixed (numbers with an integer and a fractional part) octal numbers can be represented as N = A, 8" +A,_,8''+...+4,8'+A, 8° +A, 8°+A, 87 +... where N = Number A = Digit n = Digit number Ex. 1.31: Convert (475.25), to its decimal equivalent Sol.: N = 4x87 +78! 45x89 + 2x87 + 5x8? 56 +56 + 5 + 0.25 + 0.078125 = 31732813, 1.4.4 Decimal to Octal Conversion . To convert decimal number to its octal equivalent, we have to progressively divide the decimal number by 8 and write down remainders. By taking the remainders in the reverse order we get the octal number. image not available - Digital Techniques 19 Number Systems 1.4.7 Octal to Binary Conversion Conversion from octal to binary is a reversal of the process explained in the previous section. Each digit of the octal number is individually converted to its binary equivalent to get octal to binary conversion of the number. Ex. 1.35: Convert (634), to binary. Sol.: 6 3 4 110 011 100 Binary number = 110 011100 Ex. 1.36 : Convert (72563), to binary. Sol. : 7 2 5.6 3 111 010 101 . 110 O11 Binary number = 111010101 .110 011 1.4.8 Usefulness of Octal System When dealing with a large quantity of binary numbers of many bits, itis convenient to use octal numbers as a "shorthand" means of expressing large binary numbers. But it is necessary to keep in mind that the digital circuits and systems work strictly in binary; we are using octal only as a convenience for the operators of the system. Review Questions 1. Convert following octal numbers to decimal. (a) 305, (6) 712, (c) 416, 2. Convert following decimal numbers to octal (a)129,9 (b)0178,, (c) 7.356815 3. Convert following octal numbers to binary. (a)512, (b) 0.362y (c) 675.12, 4. Convert following binary numbers to octal. (a)1011110101, (b)10011011.10111011, 1.4.9 Octal Arithmetic The sum of two octal digits is the same as their decimal sum, provided the decimal sum is less than 8. If the decimal sum is 8 or greater, subtract 8 to obtain the octal digit. A carry of 1 is produced when the decimal sum is corrected this way, as illustrated in the following examples. Ex. 1.37: @) 4, +2, b)6,+7, C)1g+75 Sol.: a) 4,42, = 6, b) 6, +7, = (13-8)5, carry 1 c) 1,+7, =(8-8)0, carry 1 Note : Subscript 8 denotes it is an octal number Digi fechniques 20 Number Systems To obtain the sum of multi-digit octal numbers, the procedure just described is applied to each column of digits as illustrated in the following example. Ex. 1.38: Add 167, and 325, Sol.: 11_ ¢Cany 167 + 325 514, If the decimal sum of several octal digits is 16 or greater, subtract 16 and set carry equal to 2. In general, we can express any decimal sum in octal by repeatedly subtracting 8 until the result is one of the octal digits through 0 to 7. Each time 8 is subtracted, the amount of the carry is increased by 1. This procedure is illustrated in the following example. Ex.1.39: Add the octal numbers 341,,125,,47 2, and577, Sol. : 121. «Cary +44 ane NNN Nae 1757, The better way to perform octal subtraction is to convert the numbers to binary, perform the subtraction, and convert the result back to octal. However, the complement methods already described for binary can also be used. The7's and 8's complements for octal numbers are found and used like 1's and 2's complements to perform subtraction. Subtraction with 7's complement The 7's complement of an octal number is found by subtracting each digit from 7, as illustrated in Ex. 1.40. Ex.1.40: Find 7's complement of 612, Sol.: 777 - 612 . 165, The steps for octal subtraction using 7's complement method are as given below: Step 1: Find 7's complement of subtrahend Step 2 : Add two octal numbers (first number and 7's complement of the second number) Setp 3: If carry is produced in the addition, add carry in the least significant bit of the sum; otherwise find 7's complement of the sum as a result with negative sign. Ex. 1.41: Use the 7's complement method of subtraction to compute 176 , -157 Sol: Step 1: 777 -157 620 7's complement Digital Techniques 21 Number Systems 1 carry Step 2: 176 +620 carry > 016 Step 3: 016 + 1 017 176 ,-157 , -» 017, Bx. 142: Use the 7’s complement method of subtraction to compute 153 4-243. Sol.: Step 1: 777 243 534 <7 complement 1 € carry Step 2: 153 +534 <7'scomplement 707 Step3: Nocarry,hence take 7's complement 777 -707 070 «7's complement of sum (-ve sum) 153,-243,>70, Subtraction With 8's Complement The 8's complement of an octal number is found by adding a 1 to the least significant bit of the 7's complement of an octal number, as illustrated in the Ex. 1.43, Ex. 1.43: Find the 8’s complement of 346, Sol. : 777 - 346 431 «7's complement + 001 © Add1 432 © 8's complement The steps for octal subtraction using 8's complement method are as given below : Step 1: Find 8's complement of subtrahend Step 2 : Add two octal numbers (first number and 8's complement of the second number). Step 3 : If carry is produced in the addition it is discarded ; otherwise find 8's complement of the sum as a result with negative sign. Digital Techniques 22 Number Systems Ex. 1.44: Use the 8's complement method of subtraction to compute 516 ,-413 Sol: Step 1: 777 - 41 o. 6 e as + 7's complement + «Add 1 365 + 8's complement eer + 365 Carry > 103 - Step 3: Carry is ignored 5164-413, 4103, Ex. 1.45: Use the 8's complement method of subtraction to compute 316 , ~ 451 Step 2: Sol: Step1: 777 ~ 451 326 €7s complement +1 327 © 8's complement 1 carry Step 2: 316 +327 645 Step 3: No carry, hence take 8's complement 777 -— 645 732 < 7's complement +1 + Add1 133 + 8's complement 2 316, -451, 9-133, Review Questions 2 1. Petfornt addition of following octal numbers. (a) 716, and125,, (b)137, and 261, (c) 463, and723, 2. Use 7's complement method of subtraction to compute following. (a) 756 ~2714(b) 561, ~112,(c) 251,577, 3, Use 8's complement method of subtraction to compute following. ~ (a) 222, -111, (b) 331-176, (c) 2154-466, Digital Techniques 23 Number Systems 1.5 Hexadecimal Number System The hexadecimal number system has a base of 16 having 16 digits :0, 1, 2,3, 4,5,6,7, 8,9, A, B, C, D, Eand F, It is another number system that is particularly useful for human communications with a computer. Although it is somewhat more difficult to interpret than the octal number system, ithas become the most popular. Since its base is a power of 2 (24), it is easy to convert hexadecimal numbers to binary and vice versa. Table 1.2 shows the relationship between decimal, binary and hexadecimal. Note that each hexadecimal digit represents a group of four binary digits, called nibbles, that are fundamental parts of larger binary words. De val Binary Hexadecimal 0 0000 0 1 0001 1 2 010 2 3 0011 3 4 0100 4 5 101 5 6 o110 6 % ou 7 8 1000 8 9 1001 9 10 1010 A a 1011 B 12 1100 c 13, 01 D 14 1110 E 15 nu F Table 1.2 Relation between decimal, binary and hexadecimal numbers When we write an hexadecimal number say 3 FD ,, it can be represented in power of 16 as

You might also like