## Digital Systems Introduction

Published in: Physics
946 views
• ### Parag P

• Indore
• Fresher
• Qualification: M. Tech. Embedded Systems
• Teaches: Statistics, Physics, Mathematics, Algebra, Electro...
• Contact this tutor

This is another tutorial of introduction to the digital systems and discusses in details about various aspects of analog verses digital systems, digitisation of analog signals. Then it draws attention to binary numbers and number systems in details. It also throws light on number system conversions. It also represents fractions and its representations. It discusses different types of binary codes with examples.

• 1
Digital Systems Introduction Presentation by Parag Parandkar
• 2
Presentation Outline ' Analog versus Digital Systems Digitization of Analog Signals Binary Numbers and Number Systems Number System Conversions ' Representing Fractions Binary Codes
• 3
Analog versus Digital Analog continuous means ' Analog parameters have continuous range of values — Example: temperature is an analog parameter — Temperature increases/decreases continuously — Like a continuous mathematical function, No discontinuity points Other examples? Digital means using numerical digits Digital parameters have fixed set of discrete values — Example: month number e {l, 2, 3 , 12} — Thus, the month number is a digital parameter (cannot be 1.5 !) Other examples?
• 4
Analog versus Digital System Are computers analog or digital systems? Computer are digital systems Which is easier to design an analog or a digital system? Digital systems are easier to design, because they deal with a limited set of values rather than an infinitely large range of continuous values The world around us is analog It is common to convert analog parameters into digital form This process is called digitization
• 5
Digitization of Analog Signals Digitization is converting an analog signal into digital form Example: consider digitizing an analog voltage signal Digitized output is limited to four values = {VI,V2,V3,V4} Voltage Time
• 6
Digitization of Analog Signals — cont'd Voltage VI Time Voltage VI Time ' Some loss of accuracy, why? ' How to improve accurac9?d more voltage values
• 7
ADC and DAC Converters Analog-to-Digital Converter (ADC) — Produces digitized version of analog signals — Analog input Digital output Digital-to-Analog Converter (DAC) — Regenerate analog signal from digital form — Digital input Analog output Our focus is on digital systems only input analog signals Analog-to-Digital Converter (ADC) input digital signals Digital System output digital signals Digital-to-Analog Converter (DAC) output analog signals Both input and output to a digital system are digital signals
• 8
Next , , ' Analog versus Digital Systems Digitization of Analog Signals Binary Numbers and Number Systems Number System Conversions ' Representing Fractions Binary Codes
• 9
How do Computers Represent Digits? Binary digits (0 and 1) are used instead of de Using electric voltage — Used in processors and digital circuits — High voltage = 1, Low voltage = 0 Using electric charge — Used in memory cells 0 its Uålféed — Charged memory cell = 1, discharged memory cell = 0 Using magnetic field — Used in magnetic disks, magnetic polarity indicates 1 or 0 Using light — Used in optical disks, surface pit indicates 1 or 0
• 10
Binary Numbers Each binary digit (called a bit) is either 1 or 0 Bits have no inherent meaning, they can represent — Unsigned and signed integers — Fractions Characters — Images, sound, etc. Bit Numbering Most Significant Bit Least Significant Bit 7 6 5 27 26 25 24 23 22 21 20 — Least significant bit (LSB) is rightmost (bit 0) — Most significant bit (MSB) is leftmost (bit 7 in an 8-bit number)
• 11
Decimal Value of Binary Numbers ' Each bit represents a power of 2 Every binary number is a sum of powers of 2 Decimal Value = (dh4 x 21) 100111 25 24 23 22 o 21 1 20 Some common powers of 2 Decimal Value 16 32 128 10 11 12 13 14 15 Decimal Value 256 512 1024 2048 4096 8192 16384 32768
• 12
Positional Number Systems Different Representations of Natural Numbers XXVII Roman numerals (not positional) 27 Radix-IO or decimal number (positional) 110112 Radix-2 or binary number (also positional) Fixed-radix positional representation with n digits Number N in radix r = (d d . dido) r n—2 N r Value = dn n-l + dn 11-2 + + + do Examples: (11011)2 = (2107)8 = + + OX 22 + 1 2x83 + + +7 = 1095 = 27
• 13
Convert Decimal to Binary Repeatedly divide the decimal integer by 2 Each remainder is a binary digit in the translated value Example: Convert 3710 to Binary Division 37 / 2 18/2 9/2 4/2 2/2 Quotient 18 9 4 2 1 Remainder (1 (1 o 1 least significant bit 37 = (100101)2 most significant bit stop when quotient is zero
• 14
Decimal to Binary Conversion N = (dn_l x 2n-1) + + (dl x 21) + (do x 20) Dividing N by 2 we first obtain — Quotientl = (dn_l x 211-2) + ... + (d2 X 2) + dl — Remainderi = do — Therefore, first remainder isleast significant bit of binary number Dividing first quotient by 2 we first obtain — Quotient2 = (dn_l x 2n-3) + ... + (d3 >< 2) + d2 — Remainder2 = dl Repeat dividing quotient by 2 — Stop when new quotient is equal to zero — Remainders are the bits from least to most significant bit
• 15
Popular Number Systems Binary Number System: Radix = 2 — Only two digit values: 0 and 1 — Numbers are represented as Os and Is Octal Number System: Radix = 8 — Eight digit values: 0, l, 2, 7 Decimal Number System: Radix = 10 — Ten digit values: 0, l, 2 9 Hexadecimal Number Systems: Radix = 16 — Sixteen digit values: 0, l, 2 -A = 10, B =11,... F = 15 Octal and Hexadecimal numbers can be converted easily to Binary and vice versa
• 16
Octal and Hexa Octal = Radix 8 Only eight digits: 0 to 7 Digits 8 and 9 not used Hexadecimal = Radix 16 16 digits: 0 to 9, A to F A=IO, B=ll, F=15 First 16 decimal values (0 to 15) and their values in binary, octal and hex. Memorize table Decimal Radix 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary Radix 2 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 Octal Radix 8 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 Hex Radix 16 0 1 2 3 4 5 6 7 8 9 c
• 17
Binary, Octal, and Hexadecimal Binary, Octal, and Hexadecimal are related: Radix 16 = 24 and Radix 8 = 23 Hexadecimal digit = 4 bits and Octal digit = 3 bits Starting from least-significant bit, group each 4 bits into a hex digit or each 3 bits into an octal digit Example: Convert 32-bit number into octal and hex 35305523 6 2 4 Octal 1 9 4 32-bit binary Hexadecimal
• 18
Converting Octal & Hex to Decimal : 8 = (dn_l X 8n-1) + (dl X 8) ' Octal to Decimal N : 16 = (dn_l X 16n-1) + (dl X ' Hex to Decimal N 16) + do ' Examples: 8 (7 x 83) + (2 x 82) + (0 x 8) 3716 (7204) = = (3 X 163) + (11 X 162) + (10 X 16) +4 (3BA4) = 15268
• 19
Converting Decimal to Hexadecimal Repeatedly divide the decimal integer by 16 Each remainder is a hex digit in the translated value Example: convert 422 to hexadecimal Division 422 / 16 26/ 16 1/16 422 = Quotient 26 1 Remainder 6 1 stop when quotient is zero least significant digit most significant digit To convert decimal to octal divide by 8 instead of 16
• 20
Important Properties ' How many possible digits can we have in Radix r ? r digits: 0 to r — 1 What is the result of adding 1 to the largest digit in Radix r? Since digit r is not represented, result is (10)r in Radix r Examples: 12 + 1 = (10)2 910+1 - What is the largest value using 3 digits in Radix r? -1 In binary: (111)2 = 23 — 1 In octal: (777)8 = 83 1 - 103-1 In decimal: (999)10 — In Radix r: largest value = r3
• 21
Important Properties — cont'd ' How many possible values can be represented Using n binary digits? 2n values: 0 to 2n — 1 Using n octal digits 8n values: 0 to 8n -1 Using n decimal digits? Ion values: 0 to Ion - 1 Using n hexadecimal digit\$6n values: 0 to 16n - 1 Using n digits in Radix r values: O to rn- 1
• 22
Next , , ' Analog versus Digital Systems Digitization of Analog Signals Binary Numbers and Number Systems Number System Conversions ' Representing Fractions Binary Codes
• 23
Representing Fractions ' A number N r in radix r can also have a fraction part: Nr=d d n-l n-2 Integer Part Osdi
• 24
Examples of Numbers with Fractions (2409.87)10 (1101.1001)2 (703.64)8 (AIF.8)16 (423. 1 (263.5)6 = + + 9 + 8X10-I + 7 X 10-2 = 23 + 22 + 20 + 2-1 + 2-4 = 13.5625 = + 3 + + = 451.8125 = 10X162 + 16 + 15 + 8x16-l = 2591.5 = + +3+51 - = 113.2 Digit 6 is NOT allowed in radix 6
• 25
Converting Decimal Fraction to Binary ' Convert N = 0.6875 to Radix 2 , Solution: Multiply N by 2 repeatedly & collect integer bits New Fraction Bit Multiplication 0.6875 2 = 1 .375 0.375 2 = 0.75 0.75 x 2 = 1 .5 0.5 x 1 .0 0.375 0.75 0.5 0.0 1 1 1 First fraction bit Last fraction bit ' Stop when new fraction = 0.0, or when enough fraction bits are obtained Therefore, N = 0.6875 = (0.1011)2 Check (0.1011)2 = 2-1 + 2-3 + 2-4 = 0.6875
• 26
Converting Fraction to any Radix r To convert fraction N to any radix r (O.d_ld2 Multiply N by r to obtain d -1 + d x 1114-1 The integer part is the digit in radix r -1 + d x 171-1-1 The new fraction is d x r Repeat multiplying the new fractions by r to obtain Stop when new fraction becomes 0.0 or enough fraction digits are obtained
• 27
More Conversion Examples ' Convert N = 139.6875 to Octal (Radix 8) ' Solution: N = 139 + 0.6875 (split integer from fraction) The integer and fraction parts are converted separately Division Quotient Remainder Multiplication New Fraction Digit 139/8 17/8 2/8 2 3 1 2 0.6875 x 8 = 5.5 0.5 4.0 0.5 0.0 5 4 Therefore, 139 = (213)8 and 0.6875 = (0.54)8 Now, join the integer and fraction parts with radix point N = 139.6875 = (213.54)8
• 28
Conversion Procedure to Radix r To convert decimal number N (with fraction) to radix r Convert the Integer Part — Repeatedly divide the integer part of number N by the radix r and save the remainders. The integer digits in radix r are the remainders in reverse order of their computation. If radix r > 10, then convert all remainders > 10 to digits A, B, ... etc. Convert the Fractional Part — Repeatedly multiply the fraction of N by the radix r and save the integer digits that result. The fraction digits in radix r are the integer digits in order of their computation. If the radix r > 10, then convert all digits > 10 to A, B, ... etc. Join the result together with the radix point
• 29
Simplified Conversions Converting fractions between Binary, Octal, and Hexadecimal can be simplified Starting at the radix pointing, the integer part is converted from right to left and the fractional part is converted from left to right Group 4 bits into a hex digit or 3 bits into an octal digit + integer: right to left — fraction: left to right Octal 8 3 C A 8 Hexadecimal 7 B 5 5 Use binary to convert between octal and hexadecimal
• 30
Important Properties of Fractions ' How many fractional values exist with m fraction bits? 2m fractions, because each fraction bit can be 0 or 1 What is the largest fraction value if m bits are used? Largest fraction value = 2-1 + 2-2 + ... + 2-m Because if you add 2-m to largest fraction you obtain 1 ' In general, what is the largest fraction value if m fraction digits are used in radix r? Largest fraction value = r-l + r-2 + + r-m = I—r- For decimal, largest fraction value = 1 10-m For hexadecimal, largest fraction value = 1 16-m
• 31
Next , , ' Analog versus Digital Systems Digitization of Analog Signals Binary Numbers and Number Systems Number System Conversions ' Representing Fractions Binary Codes
• 32
Binary Codes How to represent characters, colors, etc? Define the set of all represented elements Assign a unique binary code to each element of the set Given n bits, a binary code is a mapping from the set of elements to a subset of the 2n binary numbers ' Coding Numeric Data (example: coding decimal digits) — Coding must simplify common arithmetic operations — Tight relation to binary numbers ' Coding Non-Numeric Data (example: coding colors) — More flexible codes since arithmetic operations are not applied
• 33
Example of Coding Non-Numeric Data Suppose we want to code 7 colors of the rainbow As a minimum, we need 3 bits to define 7 unique values Color 3-bit code 3 bits define 8 possible combinati ed Orange ' Only 7 combinations are needed Yellow ' Code 111 is not used Green Blue Indigo Other assignments are also possib q/iolet 000 001 010 011 IOO 101 110
• 34
Minimum Number of Bits Required Given a set of M elements to be represented by a binary code, the minimum number of bits, n, should satisfy: 2(n-l) < M < n = r log2 Ml where rx I , called the ceiling function, is the integer greater than or equal to x ' How many bits are required to represent decimal digits with a binary code?
• 35
Decimal Codes Binary number system is most natural for computers But people are used to the decimal system Must convert decimal numbers to binary, do arithmetic on binary numbers, then convert back to decimal To simplify conversions, decimal codes can be used Define a binary code for each decimal digit Since 10 decimal digits exit, a 4-bit code is used But a 4-bit code gives 16 unique combinations 10 combinations are used and 6 will be unused
• 36
Binary Coded Decimal (BCD) Simplest binary code for decimal digits ' Only encodes ten digits from 0 to 9 BCD is a weighted code The weights are 8,4,2,1 Same weights as a binary number There are six invalid code words Example on BCD coding: 13 (0001 OOII)BO Decimal BCD O 1 2 3 4 5 6 7 8 9 0000 0001 0010 0011 01 oo 01 01 0110 0111 I OOO 1001
• 37
Warning: Conversion or Coding? Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a binary code 13 (0001 0011)BCD This is conversion This is coding ' In general, coding requires more bits than conversion A number with n decimal digits is coded with 4n bits in BCD
• 38
Other Decimal Codes Many ways to assign 4-bit code to 10 decimal digits Each code uses only 10 combinations out of 16 Decimal BCD Excess-3 BCD and 8, 4, -2, -1 are weighted codes Excess-3 and 8,4,-2,-1 are self-complementing codes Note that BCD is NOT self-complementing o 1 2 3 4 5 6 7 8 9 0000 0001 0010 0011 0100 0101 0110 0111 1000 I OOI 0011 01 oo 01 01 0110 0111 1000 I OOI 1010 1011 1100 0000 0111 0110 0101 0100 1011 1010 I OOI 1000
• 39
Gray Code As we count up/down using binary codes, the number of bits that change from one binary value to the next varies 000 ..............> 001 (I-bit change) 001 .............> 010 (2-bit change) 011 100 (3-bit change) Gray code: only 1 bit changes as we count up or down Binary reflected code Digit o 1 2 3 4 5 6 7 Binary Gray Code 000 OOI 010 Oil IOO 101 110 111 000 OOI Oil 010 110 111 101 IOO Gray code can be used in low-power logic circuits that count up or down, because only 1 bit changes per count
• 40
Character Codes Character sets — Standard ASCII: 7-bit character codes (0 — 127) — Extended ASCII: 8-bit character codes (0 — 255) — Unicode: 16-bit character codes (0 — 65,535) — Unicode standard represents a universal character set ' Defines codes for characters used in all major languages Used in Windows-XP: each character is encoded as 16 bits - UTF-8: variable-length encoding used in HTML ' Encodes all Unicode characters Uses 1 byte for ASCII, but multiple bytes for other characters Null-terminated String — Array of characters followed by a NULL character
• 41
Printable ASCII Codes space Examples: + ASCII code for space character = 20 (hex) = 32 (decimal) + ASCII code for 'L' = 4C (hex) = 76 (decimal) + ASCII code for 'a' = 61 (hex) = 97 (decimal)
• 42
Control Characters The first 32 characters of ASCII table are used for control Control character codes = 00 to IF (hexadecimal) Not shown in previous slide Examples of Control Characters character used to terminate a string Character 0 is the NULL Character 9 is the Horizontal Tab (HT) character Character OA (hex) = 10 (decimal) is the Line Feed (LF) Character OD (hex) = 13 (decimal) is the Carriage Return (CR) The LF and CR characters are used together They advance the cursor to the beginning of next line One control character appears at end of ASCII table Character 7F (hex) is the Delete (DEL) character
• 43
Parity Bit & Error Detection Codes Binary data are typically transmitted between computers Because of noise, a corrupted bit will change value ' To detect errors, extra bits are added to each data value ' Parity bit: is used to make the number of I 's odd or even Even parity: number of I 's in the transmitted data is even Odd parity: number of I 's in the transmitted data is odd 7-bit ASCII Character 'A' = 1000001 'T' = 1010100 With Even Parity 0 1000001 1 1010100 With Odd Parity 1 1000001 01010100
• 44
Detecting Errors 7-bit ASCII character + 1 Parity bit S ender Sent 'A' = 01000001, Received 'A' = 01000101 Receiver Suppose we are transmitting 7-bit ASCII characters A parity bit is added to each character to make it 8 bits ' Parity can detect all single-bit errors — If even parity is used and a single bit changes, it will change the parity to odd, which will be detected at the receiver end — The receiver end can detect the error, but cannot correct it because it does not know which bit is erroneous ' Can also detect some multiple-bit errors — Error in an odd number of bits

## Need a Tutor or Coaching Class?

Post an enquiry and get instant responses from qualified and experienced tutors.

Post Requirement

Physics
2,823 views

Physics
466 views

Physics
513 views

Physics
527 views

Physics
2,419 views

Physics
880 views

Physics
823 views

Physics
1,711 views

Physics
868 views

Physics
757 views

Drop Us a Query