Introduction to signals The signals are broadly classified into two categories: 1. 2. Analog Signals. Digital signals. Analog Signals These signals have infinite number of different magnitudes / values. They varies continuously with respect to time. Ex= Sine wave , triangular wave . +v t -v Digital Signals These signals have only finite number of predetermined distinct magnitudes. Ex= Binary signal. 1 t Introduction to Analog & Digital system Analog System A system which process the analog signals are called as Analog system. Ex = Filter, Amplifier, Signal generator, Motors speed controller. Digital System A system which work on digital signal is called as digital system. Ex = Register, Flip flop, Counters etc. INTRODUCTION TO NUMBER SYSTEM Def:= Number system defines a set of values used to represents quantity. Following are the different number systems. Decimal Number system. Binary Number system. Octal Number system. Hexadecimal Number system. DECIMAL NUMBER SYSTEM Contains 10 unique symbols 0,1,2,3,4,5,6,7,8 & 9. The base / radix is 10. Positional Weighted system & its positional weights are 100, 101 , 102 , 103 etc. Ex. [1234]10 1) [1234]10 = 1*103 + 2*102 +3*101 +4*100 = 1234 2) [12.34]10 = 1*101 + 2*100 +3*10-1 +4*10-2 = 12.34 Decimal point BINARY NUMBER SYSTEM Contains only two symbols, 0 & 1. The base / radix is 2. Positional Weighted system & its positional weights are 23, 22 , 21 , 20 etc. Binary digit is called as a BIT. Ex. [1010]2 1) [1010]2 = 1*23 + 0*22 +1*21 +0*20 2) [10.10]2 = 1*21 + 0*20 +1*2-1 +0*2-2 OCTAL NUMBER SYSTEM Contains eight symbols, 0,1,2,3,4,5,6 & 7. The base / radix is 8. Positional Weighted system & its positional weights are 83, 82 , 81 , 80 etc. Octal numbers is 3 bit numbers. Ex. [23]8 1) [23]8 = 2*81 +3*80 2) [23.16]8 = 2*81 +3*80 + 1*8-1 + 6*8-2 HEXADECIMAL NUMBER SYSTEM Contains 16 symbols, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E & F. The base / radix is 16. Positional Weighted system & its positional weights are 163, 162 , 161 , 160 etc. Hexadecimal numbers is 4 bit numbers. Ex. [09AB]16 1) [09AB]16= 0*163 + 9* 162 + A*161 + B*160 2) [AB.12]16= A*161 + B* 160 + 1*16-1 + 2*16-2 NUMBER SYSTEM CONVERSION 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) There are 12 types of number system conversion. Binary to Decimal number Conversion Binary to Octal number Conversion Binary to Hexadecimal number Conversion Decimal to Binary number Conversion Decimal to Octal number Conversion Decimal to Hexadecimal number Conversion Octal to Binary number Conversion Octal to Decimal number Conversion Octal to Hexadecimal number Conversion Hexadecimal to Binary number Conversion Hexadecimal to Decimal number Conversion Hexadecimal to octal number Conversion BINARY TO DECIMAL CONVERSION Steps: 1) Write the Binary number. 2) Multiply each binary digit by its positional weight. 3) Add the product terms to obtain the decimal number. Example: 1) [1011]2 = [ ]10 [1011]2 = 1*23 + 0*22 + 1*21 + 1*20 = 8 + 0 + 2 + 1 = 11 [1011]2 = [11]10 2) [10.10]2 = [ ]10 [10.10]2 = 1*21 + 0*20 + 1*2-1 + 0*2-2 = 2 + 0 + 0.5 + 0 = 2.5 [10.10]2 = [ 2.5 ]10 DECIMAL TO BINARY CONVERSION The decimal integer is converted to binary integer by Successive Division by 2 & the decimal fraction is converted into binary fraction by Successive Multiplication by 2. This is known as Double-Dabble Method. 1) Successive Division by 2 The number is successively divided by 2 till the quotient is 0. Last Remainder is MSB. Remainders read from bottom to top, gives binary integer. 2) Successive Multiplication by 2 The number is successively multiplied by 2 till the fraction part of the product is 0 or till the desired accuracy. First Integer is MSB. Integers read from top to bottom, gives binary fraction. DECIMAL TO BINARY CONVERSION 1) [10]10 = [ ]2 10/2 5/2 2/2 1/2 Q 5 2 1 0 2) [2.5]10 = [ ]2 a) For Integer part Q 2/2 1 1/2 0 [2.5]10 =[10.1]2 R 0 1 0 1 [10]10 = [ 1010 ]2 b) For Fractional part R 0 1 0.5*2 = 1. 0 1 OCTAL TO DECIMAL CONVERSION Steps: 1) Write the Octal number. 2) Multiply each octal digit by its positional weight. 3) Add the product terms to obtain the decimal number. Example: 1) [27]8 = [ ]10 [27]8 = 2×81 + 7×80 = 16 + 7 = 23 [27]8 = [ 23 ]10 2) [23.23]8 = [ ]10 = 2×81 + 3×80 + 2×8-1 + 3×8-2 = 19 + 0.29 [23.23]8 = [19.29] 10 DECIMAL TO OCTAL CONVERSION The decimal integer is converted to octal integer by Successive Division by 8 & the decimal fraction is converted into octal fraction by Successive Multiplication by 8. 1) Successive Division by 8 The number is successively divided by 8 till the quotient is 0. Last Remainder is MSB. Remainders read from bottom to top, gives octal integer. 2) Successive Multiplication by 8 The number is successively multiplied by 8 till the fraction part of the product is 0 or till the desired accuracy. First Integer is MSB. Integers read from top to bottom, gives octal fraction. DECIMAL TO OCTAL CONVERSION 1) [19]10 = [ ]8 Q 19/8 2 2/8 0 [19]10 =[23]8 2) [0.296]10 =[ ]8 For Fractional part 0.296*8 = 2.368 2 0.368*8 = 2.994 2 0.944*8 = 7.552 7 [0.296]10 = [ 0.227 ]8 R 3 2 HEXADECIMAL TO DECIMAL CONVERSION Steps: 1) Write the Hexadecimal number. 2) Multiply each hexa digit by its positional weight. 3) Add the product terms to obtain the decimal number. Example: 1) [9.AB]16 = [ ]10 [9.AB]16= 9×160 + A×16-1 + B×16-2 = 9×1 + 10×16-1 + 11×16-2 = 9 + 0.625 + 0.0429 = [ 9.667 ] 10 DECIMAL TO HEXADECIMAL CONVERSION The decimal integer is converted to hexadecimal integer by Successive Division by 16 & decimal fraction is converted into hexa fraction by Successive Multiplication by 16. 1) Successive Division by 16 The number is successively divided by 16 till the quotient is 0. Last Remainder is MSB. Remainders read from bottom to top, gives hexadecimal integer. 2) Successive Multiplication by 16 The number is successively multiplied by 16 till the fraction part of the product is 0 or till the desired accuracy. First Integer is MSB. Integers read from top to bottom, gives hexadecimal fraction. DECIMAL TO HEXADECIMAL CONVERSION 1) 2) [95]10 =[ ]16 Q 95/16 5 5/16 0 [95]10 = [5F]16 R 15 (F) 5 [95.95]10 =[ ]16 a) For real part [95]10 = [ 5F]16 [95.95]10 = [ 5F.F33 ]16 b) For Fractional part 0.95*16 = 15.2 15 0.2*16 = 3.2 3 0.2*16 = 3.2 3 [.95]10 = [ .F33 ]16 BINARY TO OCTAL CONVERSION 1) 2) 3) Make a group of 3-bit. Integer part: Start from LSB & moving towards MSB, replace each group of 3-bit by its octal number. Fractional part: Start from MSB & moving towards LSB, replace each group of 3-bit by its octal number. Example: [001010101.101010100]2 = 001 010 101.101 010 100 = 1 2 5 . 5 2 4 = [125.524]8 OCTAL TO BINARY CONVERSION Replace each octal digit by its 3 bit binary equivalent. [23.36]8 = 2 3 . 3 6 = 010 011 . 011 110 = [010011.011110]2 BINARY TO HEXADECIMAL CONVERSION 1) 2) 3) Make a group of 4-bit. Integer part: Start from LSB & moving towards MSB, replace each group of 4-bit by its hexadecimal number. Fractional part: Start from MSB & moving towards LSB, replace each group of 4-bit by its hexadecimal number. [000111101010.101010101000]2= 0001 1110 1010 . 1010 1010 1000 = 1 E A . A A 8 = [1EA.AA8]16 HEXADECIMAL TO BINARY CONVERSION Replace each hexadecimal digit by its 4 bit binary equivalent. [ABC95.CDA]16 = A B C 9 . C D A = 1010 1011 1100 1001 . 1100 1101 1010 = [1010101111001001.110011011010]2 HEXADECIMAL TO OCTAL CONVERSION Step 1: Convert Hexadecimal number into Binary number. Step 2: Convert binary number into Octal number. Example: 1) [ABCD]16 = [ ]8 Step 1) Convert ABCD into binary equivalent. [ABCD]16 = [1010 1011 1100 1101 ]2 Step 2) Convert binary number into octal equivalent. [1010 1011 1100 1101 ]2 = [001 010 101 111 001 101 ]2 =[ 1 2 5 7 1 5]8 OCTAL TO HEXADECIMAL CONVERSION Step 1: Convert Octal number into Binary number. Step 2: Convert binary number into Hexadecimal number. Example: 1) [235.12]8 = [ ]16 Step 1) Convert 235.12 into binary equivalent. [235.12]8 = [010 011 101 . 001 010]2 Step 2) Convert binary number into Hexadecimal equivalent. [010 011 101 . 001 010]2 = [1001 1101. 0010 1000]2 =[ 9 D . 2 8]16 BINARY CODED DECIMAL (BCD) To express any decimal number in BCD, each decimal digit should be replaced by the appropriate 4-bit code. It is a weighted code. There are 6 illegal combinations 1010, 1011, 1100, 1101, 1110 and 1111. The rules of binary addition & subtraction do not apply to the entire number but only to the individual 4-bit groups. BINARY CODED DECIMAL (BCD) Decimal No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary No. 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Binary Coded Decimal (BCD) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 0001 0000 0001 0001 0001 0010 0001 0011 0001 0100 0001 0101 BINARY CODED DECIMAL (BCD) Ex: Give BCD Code for decimal number 874. Decimal number: 874 BCD Code: 1000 0111 0100 Ex: Give BCD Code for decimal no. 96.42 Decimal number: 96.42 BCD Code: 1001 0110 . 0100 0010 EXCESS-3 CODE It is also called as XS-3 Code. It is Non-Weighted Code. It is a Sequential code & can be used for arithmetic operation. Excess-3 code word derived from the BCD code word by adding (0011)2 or (3)10 to each word in BCD code. Excess-3 code are obtained: add (3)10 decimal no. BCD code Excess-3 code It has six invalid states 0000, 0001, 0010, 1101, 1110 & 1111. EXCESS-3 CODE Eg. Obtain the Excess-3 code for [428]10 Given no. 4 2 8 Binary equivalent 0100 0010 1000 Excess-3 code 0111 0101 1011 GRAY CODE It is a non-weighted code, not suitable for arithmetic operations. Here only one bit in the code group changes, each time the decimal no. is incremented. As only one bit changes at a time, it is called as unit-distance code. Gray Code Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Gray 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000 ASCII CODE ASCII stands for American Standard Code for Information Interchange, is an alphanumeric code. It is 7-bit code & the number of bit patterns are 2^7 = 128. Used to encode both the uppercase & lowercase characters of the alphabet, some special symbols & 10 decimal digits. Extensively used for printers & terminals. Binary to Gray Conversion The MSB of gray code is same as first bit of binary no. Moving from left to right, remaining bits are obtained by “EXORing” the adjacent pairs of binary no. Binary number= B4 B3 B2 B1 B0 Gray number= G4 G3 G2 G1 G0 then, => 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 0 G4= B4 G3= B4 G2= B3 G1= B2 G0= B1 B4 + B3 B3 B2 B1 B0 + B2 + B1 + B0 G4 G3 G2 G1 G0 Binary to Gray Conversion Ex: Convert [10101101]2 to its Gray code. Solution: 1 + 0 + 1 + 0 + 1 + 1 + 0 1 1 1 1 1 1 0 + 1 Binary 1 Gray Gray to Binary Conversion The MSB of binary code is same as first bit of gray code. Add by EX-OR method, each generated binary digit with gray digit in the next adjacent position. B4 = G4 B3 = B4 B2 = B3 B1 = B2 B0 = B1 + G3 G4 G3 G2 G1 G0 + G2 + G1 + G0 B4 B3 B2 B1 B0 Gray to Binary Conversion Ex: Convert [10101101]G to its binary number. Solution: 1 0 1 0 1 1 0 + 1 + 1 + 0 + 0 + 1 + 0 1 Gray + 0 1 Binary BINARY ARITHMETIC Binary Addition Binary Subtraction Binary Multiplication Binary division Binary Addition The rules for binary addition are: 0+0=0, 0+1=1, 1+0=1, 1+1=0 w/c 1 Example: 1) 10 +01 -------1 1 (no carry) 2) 1 11 +01 -------100 ( 1 + 1 = 0 carry 1 to next column, then again 1 + 1 is 0 carry 1 to next column) Binary Subtraction The rules for binary subtraction are: 0-0=0, 0-1=1w/b 1 , 1-0=1, 1-1=0 Example: 100 - 001 ------011 0 -1 = 1; with borrow of 1 from next column 0 -1(borrow) - 0 = 1, with borrow of 1 1 - 1(borrow) - 0 = 0. Answer = 011. Binary Multiplication The rules for binary multiplication are: 0×0=0, 0×1=0 , 1×0=0, 1×1=1 Example: Multiply 100 by 101 100 ×101 --------100 +000X +100XX ----------------1010 0 Therefore, 100 × 101 = 10100 Binary Division Long division procedures similar to those in decimals are used. Example: Divide 101101 by 110 1 1 0 ) 1 0 1 1 0 1 ( 1 1 1 . 1 1 1 0 --------------------1 0 1 0 1 1 0 ----------------------1 0 0 1 1 1 0 ----------------------1 1 0 1 1 0 -----------------------0 0 0 Therefore, 101101 ÷ 110 = 111.1 BCD ADDITION 1) 2) 3) 4) Rules for addition of 2 BCD numbers are: Add the 2 numbers using the rules for binary addition. If a four bit number is equal to or less than 9, it is a valid BCD number. If a 4-bit sum is greater than 9, or if a carry-out of the group is generated, it is an invalid result. Then add 6 (0110)2 to the four bit sum in order to skip the six invalid states. If a carry results, when 6 is added, add the carry to the next 4bit group. BCD ADDITION Example: 0001 1000 0110 + 0110 1000 1000 -----------------------------------------1000 0000 1110 + 110 0110 -----------------------------------------1000 0111 0100 ------------- (874)10 BCD SUBTRACTION 1) 2) 3) 4) Rules for subtraction of 2 BCD numbers are: Subtract the 2 numbers using the rules for binary subtraction. If a four bit number is equal to or less than 9, it is a valid BCD number. if a borrow is taken from other four bit code, it is an invalid result. Then subtract 6 (0110)2 to the four bit result in order to skip the six invalid states. If a borrow results, when 6 is subtracted, subtract the borrow to the next 4-bit group. BCD SUBTRACTION Example: 1000 0110 0100 - 0010 1001 0011 -----------------------------------------0101 1101 0001 110 -----------------------------------------0101 0111 0001 ------------- (571)10