Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Linear Integrated Circuits - S. Salivahanan and v. S. K. Bhaaskaran

Download as pdf or txt
Download as pdf or txt
You are on page 1of 79

Scilab Textbook Companion for

Linear Integrated Circuits


by S. Salivahanan And V. S. K. Bhaaskaran
1
Created by
Laxman Ghanasham Sole
B.Tech.
Electronics Engineering
Vishwakarma Institute of Technology, Pune
College Teacher
Prof. Vijay Mane
Cross-Checked by
Lavitha Pereira
August 10, 2013
1
Funded by a grant from the National Mission on Education through ICT,
http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab
codes written in it can be downloaded from the Textbook Companion Project
section at the website http://scilab.in
Book Description
Title: Linear Integrated Circuits
Author: S. Salivahanan And V. S. K. Bhaaskaran
Publisher: Tata McGraw - Hill Education, New Delhi
Edition: 1
Year: 2008
ISBN: 0-07-064818-2
1
Scilab numbering policy used in this document and the relation to the
above book.
Exa Example (Solved example)
Eqn Equation (Particular equation of the above book)
AP Appendix to Example(Scilab Code that is an Appednix to a particular
Example of the above book)
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.
2
Contents
List of Scilab Codes 4
1 Integrated Circuit Fabrication 8
2 Circuit Congurations for Linear ICs 10
3 Operational Amplier Characteristics 18
4 Applications of Operational Ampliers 34
5 Operational Amplier Nonlinear Circuits 41
6 Active Filters 44
7 Waveform Generators 53
8 Voltage Regulators 59
9 Analog Multipliers 66
10 Phase Locked Loop 67
11 DAC and ADC 72
3
List of Scilab Codes
Exa 1.1 sheet resistance of Ptype diusion . . . . . . . . . . . 8
Exa 1.2 sheet resistance of polysilicon layer . . . . . . . . . . . 8
Exa 2.1 current source to proide output current . . . . . . . . 10
Exa 2.2 identical transistor circuit . . . . . . . . . . . . . . . . 10
Exa 2.3 output current of transistor . . . . . . . . . . . . . . . 11
Exa 2.4 resistance required to produce a current . . . . . . . . 12
Exa 2.5 multiple current source . . . . . . . . . . . . . . . . . 12
Exa 2.6 design current source using MOSFET . . . . . . . . . 13
Exa 2.7 dierential amplier CMRR . . . . . . . . . . . . . . . 14
Exa 2.8 Qpoint of dierential amplier . . . . . . . . . . . . . 15
Exa 2.9 Qpoint for MOSFET of dierential amplier . . . . . 16
Exa 3.1 input stage with bias circuit . . . . . . . . . . . . . . . 18
Exa 3.2 gain stage of Opamp . . . . . . . . . . . . . . . . . . . 18
Exa 3.3 output stage of opamp . . . . . . . . . . . . . . . . . . 19
Exa 3.4 average bias current . . . . . . . . . . . . . . . . . . . 20
Exa 3.5 maximum output oset voltage . . . . . . . . . . . . . 20
Exa 3.6 bias current compensation . . . . . . . . . . . . . . . . 21
Exa 3.7 Opamp drift specication . . . . . . . . . . . . . . . . 21
Exa 3.8 frequency response . . . . . . . . . . . . . . . . . . . . 22
Exa 3.9 unity gain bandwidth . . . . . . . . . . . . . . . . . . 22
Exa 3.10 open loop dc voltage gain . . . . . . . . . . . . . . . . 23
Exa 3.11 time taken to change output . . . . . . . . . . . . . . 23
Exa 3.12 undistorted sine wave . . . . . . . . . . . . . . . . . . 23
Exa 3.13 max input signal for undistorted output . . . . . . . . 24
Exa 3.14 amplify square wave with rise time . . . . . . . . . . . 24
Exa 3.15 eect of output voltage change on slew rate . . . . . . 25
Exa 3.16 max input frequency for undistorted output . . . . . . 25
Exa 3.17 max input voltage for undistorted output . . . . . . . 26
4
Exa 3.18 noise gain of circuit . . . . . . . . . . . . . . . . . . . 26
Exa 3.19 closed loop voltage gain . . . . . . . . . . . . . . . . . 26
Exa 3.20 closed loop voltage gain and beta . . . . . . . . . . . . 27
Exa 3.21 noninverting amplier circuit . . . . . . . . . . . . . . 27
Exa 3.22 noninverting amplier with IL . . . . . . . . . . . . . 28
Exa 3.23 capacitor coupled voltage follower . . . . . . . . . . . 28
Exa 3.24 high impedence capacitor coupled voltage follower . . 29
Exa 3.25 high impedence capacitor coupled noninverting amplier 30
Exa 3.26 capacitor coupled inverting amplier . . . . . . . . . . 30
Exa 3.27 capacitor coupled noninverting amplier . . . . . . . . 31
Exa 3.28 common mode gain Acm . . . . . . . . . . . . . . . . 32
Exa 3.29 dierential amplier with two opamp . . . . . . . . . . 33
Exa 4.1 phase lag circuit . . . . . . . . . . . . . . . . . . . . . 34
Exa 4.2 output current . . . . . . . . . . . . . . . . . . . . . . 35
Exa 4.3 determine the current . . . . . . . . . . . . . . . . . . 35
Exa 4.4 determine the current through RL . . . . . . . . . . . 35
Exa 4.5 determine load gain . . . . . . . . . . . . . . . . . . . 36
Exa 4.6 voltage to current converter with oating load . . . . . 36
Exa 4.7 summing amplier . . . . . . . . . . . . . . . . . . . . 37
Exa 4.8 input impedence . . . . . . . . . . . . . . . . . . . . . 38
Exa 4.9 practical integrator circuit . . . . . . . . . . . . . . . . 38
Exa 4.10 design a dierentiator . . . . . . . . . . . . . . . . . . 39
Exa 4.11 design a dierentiator using opamp . . . . . . . . . . . 39
Exa 4.12 solving dierential equation using opamp . . . . . . . 40
Exa 4.13 transfer function using opamp . . . . . . . . . . . . . . 40
Exa 5.1 transfer characteristics of comparator . . . . . . . . . 41
Exa 5.2 inverting schmitt trigger . . . . . . . . . . . . . . . . . 41
Exa 5.3 clipper circuit . . . . . . . . . . . . . . . . . . . . . . . 42
Exa 5.4 negative clamping circuit . . . . . . . . . . . . . . . . 43
Exa 6.1 rst order low pass butterworth lter . . . . . . . . . . 44
Exa 6.2 rst order low pass lter . . . . . . . . . . . . . . . . . 44
Exa 6.3 second order low pass butterworth lter . . . . . . . . 45
Exa 6.4 second order low pass butterworth lter with uppercut-
o frequency . . . . . . . . . . . . . . . . . . . . . . . 45
Exa 6.5 third order low pass butterworth lter . . . . . . . . . 46
Exa 6.6 fourth order low pass butterworth lter . . . . . . . . 47
Exa 6.7 rst order high pass lter . . . . . . . . . . . . . . . . 47
Exa 6.8 second order high pass butterworth lter variable gain 48
5
Exa 6.9 fourth order high pass butterworth lter . . . . . . . . 48
Exa 6.10 bandpass lter . . . . . . . . . . . . . . . . . . . . . . 49
Exa 6.11 bandpass lter with resonant frequency . . . . . . . . 50
Exa 6.12 narrowband bandpass lter . . . . . . . . . . . . . . . 50
Exa 6.13 narrowband bandpass lter with resonant frequency . 51
Exa 6.14 clock frequency . . . . . . . . . . . . . . . . . . . . . . 52
Exa 7.1 RC Phase shift oscillator . . . . . . . . . . . . . . . . 53
Exa 7.2 Wien bridge oscillator . . . . . . . . . . . . . . . . . . 53
Exa 7.3 Astable multivibrator . . . . . . . . . . . . . . . . . . 54
Exa 7.4 Square wave oscillator . . . . . . . . . . . . . . . . . . 55
Exa 7.5 Triangular wave generator . . . . . . . . . . . . . . . . 55
Exa 7.6 Sawtooth wave generator . . . . . . . . . . . . . . . . 56
Exa 7.7 Monostable multivibrator . . . . . . . . . . . . . . . . 57
Exa 7.8 Frequency of oscillation . . . . . . . . . . . . . . . . . 57
Exa 7.9 Astable multivibrator . . . . . . . . . . . . . . . . . . 58
Exa 7.10 Teletypewriter . . . . . . . . . . . . . . . . . . . . . . 58
Exa 8.1 Linear Voltage Regulator . . . . . . . . . . . . . . . . 59
Exa 8.2 7805 Voltage Regulator . . . . . . . . . . . . . . . . . 60
Exa 8.3 7805 Regulator Circuit . . . . . . . . . . . . . . . . . . 61
Exa 8.4 LM317 Regulator . . . . . . . . . . . . . . . . . . . . . 61
Exa 8.5 Voltage regulator using LM317 . . . . . . . . . . . . . 62
Exa 8.6 Current Limiting Circuit . . . . . . . . . . . . . . . . 63
Exa 8.7 LM723 Regulator . . . . . . . . . . . . . . . . . . . . . 63
Exa 8.8 Continuously adjustable power supply . . . . . . . . . 64
Exa 9.1 DC Component . . . . . . . . . . . . . . . . . . . . . . 66
Exa 10.1 DC Control voltage . . . . . . . . . . . . . . . . . . . 67
Exa 10.2 VCO Circuit . . . . . . . . . . . . . . . . . . . . . . . 67
Exa 10.3 PLL565 . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Exa 10.4 IC565 . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Exa 10.5 IC565 Output frequency . . . . . . . . . . . . . . . . . 70
Exa 10.6 PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Exa 10.7 IC565 as FM modulator . . . . . . . . . . . . . . . . . 71
Exa 11.1 Resolution . . . . . . . . . . . . . . . . . . . . . . . . 72
Exa 11.2 DAC resolution . . . . . . . . . . . . . . . . . . . . . . 72
Exa 11.3 Ladder type DAC . . . . . . . . . . . . . . . . . . . . 73
Exa 11.4 8bit DAC . . . . . . . . . . . . . . . . . . . . . . . . . 73
Exa 11.5 4bit converter . . . . . . . . . . . . . . . . . . . . . . . 74
Exa 11.6 Inverted R2R ladder . . . . . . . . . . . . . . . . . . . 75
6
Exa 11.7 Output voltage for digital input . . . . . . . . . . . . . 76
Exa 11.8 Resolution and dynamic range . . . . . . . . . . . . . 77
Exa 11.9 8bit ADC . . . . . . . . . . . . . . . . . . . . . . . . . 77
Exa 11.10 Successive approximation ADC . . . . . . . . . . . . . 78
7
Chapter 1
Integrated Circuit Fabrication
Scilab code Exa 1.1 sheet resistance of Ptype diusion
1 // Example 1 . 1 , page no23
2 clear
3 clc
4
5 Rs=200
6 R=5000
7 luponw= R/Rs
8 printf( L upon W =%d , luponw)
9 printf(\n5kohm r e s i s t o r can be f a b r i c a t e d by us i ng
a pat t e r n o f %d mi l 1 mi l ,luponw)
Scilab code Exa 1.2 sheet resistance of polysilicon layer
1 // Example 1 . 2 , page no23
2 clear
3 clc
4
5 Rs=30
8
6 R=1000
7 luponw=R/Rs
8 printf( L upon W =100/3 )
9 printf(\n1kohm r e s i s t o r can be f a b r i c a t e d by us i ng
a pat t e r n o f 100 mi l 3 mi l )
9
Chapter 2
Circuit Congurations for
Linear ICs
Scilab code Exa 2.1 current source to proide output current
1 // Example 2 . 1 , page no40
2 clear
3 clc
4
5 Vcc=5
6 Vbeon =0.6
7 Beta =150
8 Io=100*10^ -6
9 Iref=Io*(1+ 2/Beta)
10 Iref=Iref *10^6
11 printf( I r e f = %. 2 f uA, Iref)
12
13 R=(Vcc -Vbeon)/Iref
14 R=R*1000
15 printf(\ nRe s i s t anc e= %. 2 f kohm, R)
10
Scilab code Exa 2.2 identical transistor circuit
1 // Example 2 . 2 , page no40
2 clear
3 clc
4
5 Vbe =0.7
6 Vcc =12
7 Rc1 =1000
8 Rc2 =330
9
10 Iref=(Vcc -Vbe)/Rc1
11 I0=Iref
12 V0=Vcc -Rc2*I0
13
14 Iref=Iref /10^ -3
15 printf( I r e f = %. 1 f mA, Iref)
16 printf(\nV0= %. 3 f V, V0)
Scilab code Exa 2.3 output current of transistor
1 // Example 2 . 3 , page no40
2 clear
3 clc
4
5 Vbe =0.6
6 Vz=4.7
7 Re=1000
8
9 Vre=Vz -Vbe
10
11 I=(Vre)/Re
12 I=I/10^-3
13 printf( I=%. 1 f mA, I)
11
Scilab code Exa 2.4 resistance required to produce a current
1 // Example 2 . 4 , page no42
2 clear
3 clc
4
5 Vcc =20
6 R1 =19300
7 Vbe =0.7
8 Ic2 =0.000005
9 Vt =0.026
10
11 Ic1=(Vcc -Vbe)/R1
12
13 R2=(Vt/Ic2)*log(Ic1/Ic2)
14
15 Ic1=Ic1/10^-3
16 R2=R2 /10^3
17 printf( I c 1= %d mA,Ic1)
18 printf(\nR2= %. 2 f kohm,R2)
Scilab code Exa 2.5 multiple current source
1 // Example 2 . 5 , page no44
2 clear
3 clc
4
5 Beta =100
6 R=20000
7 Vcc=5
8 Vbe =0.6
9 Iref=(Vcc -Vbe)/R
12
10 N=3
11
12 Ic=Iref *(1+ 4/Beta)
13 Ic1=Iref*(Beta)/(Beta+N+1)
14 Ic2=Iref*(Beta)/(Beta+N+1)
15 Ic3=Iref*(Beta)/(Beta+N+1)
16
17 Iref=Iref /10^ -3
18 printf( I r e f = %. 2 f mA,Iref)
19 Ic1=Ic1/10^-3
20 printf(\ nI c1=I c 2=I c 3= %. 3 f mA,Ic1)
Scilab code Exa 2.6 design current source using MOSFET
1 // Example 2 . 6 , page no52
2 clear
3 clc
4
5 Iref =0.25*10^ -3
6 Io=0.2*10^ -3
7 kn=20*10^ -6
8 Vth=1
9 Vgs2 =1.752
10 lamb=0
11 Vdd=5
12 Vss=0
13
14 wbyltwo=Io/(kn*(Vgs2 -Vth)^2)
15 printf(W/L2= %. 1 f , wbyltwo)
16
17 Vdssat=Vgs2 -Vth
18 printf(\nVds ( s a t )= %. 3 f V, Vdssat)
19
20 Vgs1=Vgs2
21 wbylone=Iref/(kn*(Vgs2 -Vth)^2)
13
22 printf(\nW/L1= %. 1 f , wbylone)
23
24 Vgs3=Vdd -Vss -Vgs1
25 printf(\nVgs3= %. 3 f V, Vgs3)
26
27 wbylthr=Iref/(kn*(Vgs3 -Vth)^2)
28 printf(\nW/L3= %. 2 f , wbylthr)
Scilab code Exa 2.7 dierential amplier CMRR
1 // Example 2 . 7 , page no75
2 clear
3 clc
4
5 cmrra =1000
6 cmrrb =10000
7 v1a =100*10^ -6
8 v2a = -100*10^ -6
9 v1b =1100*10^ -6
10 v2b =900*10^ -6
11
12 // f o r f i r s t s e t
13 vida=v1a -v2a
14 vcma=(v1a+v2a)/2
15 vic=0
16 voa=vida *(1+ vic/(cmrra*vida))
17 voa=voa *10^6
18 printf(Vo f o r f i r s t s e t= %. 1 f uV, voa)
19
20 // f o r s econd s e t
21 vidb=v1b -v2b
22 vic=(v1b+v2b)/2
23 vob=vidb *(1+ vic/(cmrrb*vidb))
24 vob=vob *10^6
25 printf(\nVo f o r s econd s e t= %. 1 f uV, vob)
14
26 // answer i n t e xt book i s wrong
Scilab code Exa 2.8 Qpoint of dierential amplier
1 // Example 2 . 8 , page no76
2 clear
3 clc
4
5 Beta =100
6 Vee =15
7 Vcc =15
8 Vbe =0.7
9 Re =65*10^3
10 Rc =65*10^3
11 alpha =100/101
12 Ve=-0.7
13
14 Ie=(Vee -Vbe)/(2*Re)
15 Ic=alpha*Ie
16 Ib=Ic/Beta
17
18 Vc=Vcc -Ic*Rc
19
20 Vce=Vc -Ve
21
22 Ie=Ie *10^6
23 printf( I e= %. 1 f uA, Ie)
24
25 Ic=Ic *10^6
26 printf(\ nI c= %. 1 f uA, Ic)
27
28 Ib=Ib *10^6
29 printf(\ nIb= %. 3 f uA, Ib)
30
31 printf(\nVc= %. 3 f V,Vc)
15
32 printf(\nVce= %. 3 f V,Vce)
33
34 // by appr oxi mat i ng , be c aus e Vee>>Vbe
35
36 Ieapprox=Vee /(2*Re)
37 Ieapprox=Ieapprox *10^6
38 printf(\ nI e ( approx )= %. 2 f uA,Ieapprox)
Scilab code Exa 2.9 Qpoint for MOSFET of dierential amplier
1 // Example 2 . 9 , page no89
2 clear
3 clc
4
5 Vdd =12
6 Vss=-12
7 Iss =175*10^ -6
8 Rd =65*10^3
9 kn=3*10^ -3
10 Vth=1
11
12 Ids=Iss/2
13
14 Vgs=Vth + sqrt(Iss/kn)
15
16 Vds = Vdd - Ids*Rd + Vgs
17
18 // Requi rement f o r s a t u r a t i o n
19 Vicmax= Vdd - Ids*Rd + Vth
20
21 Ids=Ids *10^6
22 printf(\ nI ds=%. 1 f uA, Ids)
23 printf(\nVgs=%. 3 f V, Vgs)
24 printf(\nVds=%. 2 f V, Vds)
25 printf(\nVicmax=%. 2 f V, Vicmax)
16
26 printf(\ nRequi rement o f s a t u r a t i o n f o r M1 \ nf o r non
z e r o Vi c n e c e s s i a t e s Vi c <= 7. 312 V)
17
Chapter 3
Operational Amplier
Characteristics
Scilab code Exa 3.1 input stage with bias circuit
1 // Example 3 . 1 , page no107
2 clear
3 clc
4
5 Vp=15
6 Vm=-15
7 R5 =40*10^3
8 Vbe11 =0.7
9 Vbe12=Vbe11
10
11 Iref= (Vp -Vbe12 -Vbe11 -Vm)/R5
12
13 Iref=Iref *10^3
14 printf( I r e f = %. 3 f mA, Iref)
Scilab code Exa 3.2 gain stage of Opamp
18
1 // Example 3 . 2 , page no107
2 clear
3 clc
4
5 Iref= 0.715*10^ -3
6 Ic13b= 0.75* Iref
7 Ic17=Ic13b
8 Ie17=Ic13b
9 Beta =150
10 Vbe17 =0.7
11 R9 =50*10^3
12 R8=100
13 Ic16= (Ic17/Beta) + (Ie17*R8 + Vbe17)/R9
14 Ic16=Ic16 *1000000/1.232
15 printf(\ nI c16= %. 1 f uA, Ic16)
Scilab code Exa 3.3 output stage of opamp
1 // Example 3 . 3 , page no108
2 clear
3 clc
4
5 Iref =0.000715
6 Vbe19 =0.7
7 Is18 =10^ -14
8 Is19 =10^ -14
9 R10 =50000
10
11 Is14 =2*10^ -14
12 Is20 =2*10^ -14
13
14 Ic13a =0.25* Iref
15 Vbe =0.7
16 Ir10=Vbe19/R10
17 Ic19=Ic13a -Ir10
19
18 Vbe19 =0.612
19 Beta =200
20
21 Ib19=Ic19/Beta
22 Ic18=Ir10+Ib19
23 Vbe18 =0.549
24 Vbb=Vbe18+Vbe19
25 printf( Vbb= %. 3 f V , Vbb)
26 Ic14=Is20*exp(Vbb /2*0.026)
27 Ic14=Ic14 *10^15/0.2042
28 printf( \ nI c14= %. 2 f uA , Ic14)
Scilab code Exa 3.4 average bias current
1 // Example 3 . 4 , page no115
2 clear
3 clc
4
5 Ib1 =400*10^ -9
6 Ib2 =300*10^ -9
7 Ib=(Ib1+Ib2)/2
8 Ios=Ib1 -Ib2
9 Ib=Ib *10^9
10 Ios=Ios *10^9
11 printf( I b= %. 1 f nA , Ib)
12 printf( \ nI os= %. 1 f nA , Ios)
Scilab code Exa 3.5 maximum output oset voltage
1 // Example 3 . 5 , page no115
2 clear
3 clc
4
20
5 Ios =400*10^ -9
6 Rf =100*10^3
7 R1 =1*10^3
8 Vo=Rf*Ios
9 Vo=Vo *1000
10 printf( Vo= %. 1 f mV , Vo)
Scilab code Exa 3.6 bias current compensation
1 // Example 3 . 6 , page no117
2 clear
3 clc
4
5 Rf =10*10^3
6 R1 =2*10^3
7 Vos =5*10^ -3
8 Ios =50*10^ -9
9 Ib=200*10^ -9
10 Ta=25
11
12 // wi t hout compens at i ng r e s i s t o r
13 Vot =(1+Rf/R1)*Vos + Rf*Ib
14 Vot=Vot *1000
15 printf( Vot= %. 1 f mV , Vot)
16
17
18 // wi th compens at i ng r e s i s t o r
19 Vot =(1+Rf/R1)*Vos + Rf*Ios
20 Vot=Vot *1000
21 printf( \nVot= %. 1 f mV , Vot)
Scilab code Exa 3.7 Opamp drift specication
21
1 // Example 3 . 7 , page no119
2 clear
3 clc
4 // Part A
5 Vos =1.5*10^ -3
6 Rf =1*10^6
7 R1 =100*10^3
8 Vo=Vos *(1+Rf/R1)
9 Vo=Vo *1000
10 printf( Vo= %. 1 f mV ,Vo)
11
12 // Part B
13 Iosch= 10*10^ -9
14 Vosch=Iosch*Rf
15 Vosch=Vosch *1000
16 printf( \nChange i n Vo= %. 1 f mV ,Vosch)
17 printf( \n Worst c as e d r i f t i s 26. 5 mV or 26.5 mV )
Scilab code Exa 3.8 frequency response
1 // Example 3 . 8 , page no125
2 clear
3 clc
4 f=1000
5 // f rom graph
6 gain_db =60
7 gain =1000
8 printf( Gain= %d ,gain)
Scilab code Exa 3.9 unity gain bandwidth
1 // Example 3 . 9 , page no126
2 clear
22
3 clc
4
5 riset =0.7*10^ -6
6 bw =0.35/ riset
7 bw=bw /1000
8 printf( Bandwi dth= %d kHz ,bw)
Scilab code Exa 3.10 open loop dc voltage gain
1 // Example 3 . 1 0 , page no126
2 clear
3 clc
4
5 ugb =1.5*10^6
6 f1 =2*10^3
7 A0=ugb/f1
8 printf( Openl oop Dc Vol t age gai n= %d ,A0)
Scilab code Exa 3.11 time taken to change output
1 // Example 3 . 1 1 , page no134
2 clear
3 clc
4
5 Voch =10
6 slew =0.5
7 time=Voch/slew
8 printf( Time= %d us ,time)
Scilab code Exa 3.12 undistorted sine wave
23
1 // Example 3 . 1 2 , page no135
2 clear
3 clc
4 // Part A
5 slew =0.5
6 Vm=12
7 fmax=slew /(2* %pi*Vm)
8 fmax=fmax *1000
9 printf( Fmax= %. 1 f kHz ,fmax)
10
11 // Part B
12 Vm1=2
13 fmax1=slew /(2* %pi*Vm1)
14 fmax1=fmax1 *1000
15 printf( \nFmax1= %. 1 f kHz ,fmax1)
Scilab code Exa 3.13 max input signal for undistorted output
1 // Example 3 . 1 3 , page no135
2 clear
3 clc
4
5 slew =0.5
6 f=10*10^3
7 Vmmax=slew /(2* %pi*f)
8 Vmmax=Vmmax *10^6
9 printf( Vm( max)= %. 2 f Hz ,Vmmax)
Scilab code Exa 3.14 amplify square wave with rise time
1 // Example 3 . 1 4 , page no135
2 clear
3 clc
24
4
5 slew =0.5
6 riset=4
7 printf( \nVo i s g r e a t e r than 1V )
8 Vswing =(0.9 -0.1)*5
9 slewreq=Vswing/riset
10 printf( \ nSl ew Rate Requi r ed= %d V/ us ,slewreq)
Scilab code Exa 3.15 eect of output voltage change on slew rate
1 // Example 3 . 1 5 , page no135
2 clear
3 clc
4
5 Vch =20
6 time=4
7 slew=Vch/time
8 printf( \ nSl ew Rate = %d V/ us ,slew)
Scilab code Exa 3.16 max input frequency for undistorted output
1 // Example 3 . 1 6 , page no136
2 clear
3 clc
4
5 A=50
6 slew =0.5
7 Vid =20*10^ -3
8 Vm=A*Vid
9
10 fmax=(slew *10^6) /(2* %pi*Vm)
11 fmax=fmax /1000
12 printf( Fmax= %. 1 f kHz , fmax)
25
Scilab code Exa 3.17 max input voltage for undistorted output
1 // Example 3 . 1 7 , page no136
2 clear
3 clc
4
5 slew =0.5
6 f=4.0*10^4
7 Vm=(slew *10^6) /(2* %pi*f)
8 printf( Vpeak= %. 2 f V ,Vm)
9 Vmpp =2*Vm/10
10 printf( \ nVol t age peaktopeak= %. 3 f V ,Vmpp)
Scilab code Exa 3.18 noise gain of circuit
1 // Example 3 . 1 8 , page no138
2 clear
3 clc
4
5 Rf =10*10^3
6 R1=100
7 Vni =1*10^ -6
8 Kn=1+Rf/R1
9 Vno=Vni *(1+Rf/R1)
10 Vno=Vno *10^6
11 printf( Output no i s e v o l t a g e= %d uV ( rms ) , Vno)
Scilab code Exa 3.19 closed loop voltage gain
26
1 // Example 3 . 1 9 , page no142
2 clear
3 clc
4
5 Rf =10*10^3
6 R1 =1*10^3
7 Av=-Rf/R1
8 printf( Cl os ed l oop v o l t a g e gai n= %d ,Av)
Scilab code Exa 3.20 closed loop voltage gain and beta
1 // Example 3 . 2 0 , page no147
2 clear
3 clc
4
5 Rf =10*10^3
6 R1 =1*10^3
7 Av=1+ Rf/R1
8 printf( Cl os ed l oop v o l t a g e gai n= %d ,Av)
9
10 Beta=R1/(Rf+R1)
11 printf( \ nFeedback f a c t o r= %. 3 f ,Beta)
Scilab code Exa 3.21 noninverting amplier circuit
1 // Example 3 . 2 1 , page no147
2 clear
3 clc
4
5 R1 =10*10^3
6 R2 =1*10^3
7 R3 =1*10^3
8 Rf =50*10^3
27
9 I=1/(R2+R3)
10 Vi1=I*R2
11 Vo=Vi1 *(1+ Rf/R1)
12 printf( Vout= %d V ,Vo)
Scilab code Exa 3.22 noninverting amplier with IL
1 // Example 3 . 2 2 , page no147
2 clear
3 clc
4
5 Vi=0.6
6 Vi1 =0.6
7 Vi2 =0.6
8 R1 =10*10^3
9 Rf =20*10^3
10 RL =2*10^3
11 I1=Vi/R1
12 I1=I1 *1000
13 Av=1+Rf/R1
14 printf( Av=%d ,Av)
15 Vo=Av*Vi
16 printf( \nVo=%. 1 f V ,Vo)
17 IL=Vo/RL
18 IL=IL *1000
19 printf( \ nI 1=%. 1 f mA ,IL)
20
21 //By Ki r c hhof f s c ur r e nt l aw
22 Io=I1+IL
23 printf( \ nI o=%. 2 f mA , Io)
Scilab code Exa 3.23 capacitor coupled voltage follower
28
1 // Example 3 . 2 3 , page no151
2 clear
3 clc
4
5 fL=50
6 RL =3.3*10^3
7 Ibmax =500*10^ -9
8 R1max =140*10^3
9 C1 =1/(2* %pi*fL*R1max /10)
10 C1=C1 *10^6
11 printf( C1=%. 3 f uF ,C1)
12
13 C2 =1/(2* %pi*fL*RL)
14 C2=C2 *10^6
15 printf( \nC2=%. 2 f uF ,C2)
Scilab code Exa 3.24 high impedence capacitor coupled voltage follower
1 // Example 3 . 2 4 , page no153
2 clear
3 clc
4 Vbe =0.6
5 Ibmax =500*10^ -9
6 fL=50
7 RL =3.3*10^3
8 R1max =0.1* Vbe/Ibmax
9 R1=R1max/2
10 R2=R1
11
12 C3 =1/(2* %pi*fL*RL)
13 C3=C3 *10^6
14 printf( \nC3=%. 2 f uF ,C3)
15
16 C2 =1/(2* %pi*fL*R2/10)
17 C2=C2 *10^6
29
18 printf( \nC2=%. 2 f uF ,C2)
19 // answer i n t e xt book i s wrong
20
21 Mmin =50000
22 Zinmin =(1+ Mmin)*56*10^3
23 Zinmin=Zinmin /10^6
24 printf( \ nZi n ( min )= %d Mohm ,Zinmin)
Scilab code Exa 3.25 high impedence capacitor coupled noninverting am-
plier
1 // Example 3 . 2 5 , page no156
2 clear
3 clc
4
5 Vo=3
6 Vi=10*10^ -3
7 R2 =1*10^6
8 Av=300
9 fL=100
10 RL =15*10^3
11 R3=R2/(Av -1)
12
13 R1=R2-R3
14 C2 =1/(2* %pi*fL*R3)
15 C2=C2 *10^6
16 printf( \nC2= %. 2 f uF ,C2)
17
18 C3 =1/(2* %pi*fL*RL/10)
19 C3=C3 *10^6
20 printf( \nC3= %. 2 f uF ,C3)
Scilab code Exa 3.26 capacitor coupled inverting amplier
30
1 // Example 3 . 2 6 , page no159
2 clear
3 clc
4
5 fL=20
6 fH=2000
7 RL=300
8 R1 =1.5*10^3
9 R2 =56*10^3
10
11 C1 =1/(2* %pi*fL*R1/10)
12 C1=C1 *10^6
13 printf( \nC1= %d uF ,C1)
14
15 C2 =1/(2* %pi*fL*RL)
16 C2=C2 *10^6
17 printf( \nC2= %. 1 f uF ,C2)
18
19 Cf =1/(2* %pi*fH*R2)
20 Cf=Cf *10^12
21 printf( \nCf= %d pF ,Cf)
Scilab code Exa 3.27 capacitor coupled noninverting amplier
1 // Example 3 . 2 7 , page no162
2 clear
3 clc
4
5 Ibmax =500*10^ -9
6 Vcc =24
7 I2=50*10^ -6
8 Vo=6
9 Av=100
10 fL=100
11 RL =5.6*10^3
31
12
13 I2=100* Ibmax
14 R1=Vcc /(2*I2)
15 R2=R1
16 Vi=Vo/Av
17
18 I4=100* Ibmax
19 R4=Vi/I4
20
21 R3 =118.8*10^3
22 R1pR2=(R1+R2)/4
23
24 C1 =1/(2* %pi*fL*R1pR2 /10)
25 C1=C1 *10^6
26 printf( \nC1= %. 3 f uF ,C1)
27
28 C2 =1/(2* %pi*fL*RL/10)
29 C2=C2 *10^6
30 printf( \nC2= %. 3 f uF ,C2)
31
32 C3 =1/(2* %pi*fL*R4)
33 C3=C3 *10^6
34 printf( \nC3= %. 3 f uF ,C3)
Scilab code Exa 3.28 common mode gain Acm
1 // Example 3 . 2 8 , page no166
2 clear
3 clc
4
5 cmrr =10^5
6 Adm =10^5
7 Acm=Adm/cmrr
8 printf( Common mode gai n Acm= %d , Acm)
32
Scilab code Exa 3.29 dierential amplier with two opamp
1 // Example 3 . 2 9 , page no168
2 clear
3 clc
4
5 R1=560
6 R3=560
7 Rf =5.6*10^3
8 R2=Rf
9 Vo1=-2
10 Ri =2*10^6
11 Vo2=-1
12
13 // Part 1
14 Ad=1+Rf/R1
15 printf( \nAd= %d , Ad)
16
17 // Part 2
18 A=200000
19 Ri1=Ri*(1+ (A*R2)/(R2+R3))
20 Ri1=Ri1 /10^9
21 printf( \nRi 1=%. 1 f Gohm , Ri1)
22
23 Ri2=Ri*(1+ (A*R1)/(R1+Rf))
24 Ri2=Ri2 /10^9
25 printf( \nRi 2=%. 2 f Gohm , Ri2)
26
27 // Part 3
28 Vid=Vo2 -Vo1
29 Vo=(1+Rf/R1)*Vid
30 Vo=Vo
31 printf( \nVo=%d V ,Vo)
33
Chapter 4
Applications of Operational
Ampliers
Scilab code Exa 4.1 phase lag circuit
1 // Example 4 . 1 , Page No185
2 clear
3 clc
4
5 R1 =20*10^3
6 R=39*10^3
7 f=2000
8 Rf=R1
9 C=10^ -9
10 fo =1/(2* %pi*R*C)
11
12 theta=-2*atan(f/fo)
13 theta=theta *180/ %pi
14 printf( Phase angl e=%. 1 f de gr e e , theta)
15
16 td=theta/(f*360)
17 td=-td *10^6
18 printf( \nTime de l ay td= %. 1 f us ,td)
34
Scilab code Exa 4.2 output current
1 // Example 4 . 2 , Page No187
2 clear
3 clc
4
5 Vee =12
6 Vcc=5
7 Vdiff=Vee -Vcc
8 RL=1000
9 IL=Vdiff/RL
10 IL=IL *1000
11 printf( Cur r ent t hr ough RL i s IL= %d mA, IL)
Scilab code Exa 4.3 determine the current
1 // Example 4 . 3 , Page No187
2 clear
3 clc
4
5 V=5
6 R=1000
7 I=V/R
8 I=I*1000
9 printf( Cur r ent= %d mA, I)
Scilab code Exa 4.4 determine the current through RL
1 // Example 4 . 4 , Page No187
35
2 clear
3 clc
4
5 Vcc =15
6 Re2 =1000
7 Vc1=5
8 Ve2=5
9 I=(Vcc -Ve2)/Re2
10 I=I*1000
11 printf( Cur r ent= %d mA, I)
Scilab code Exa 4.5 determine load gain
1 // Example 4 . 5 , Page No189
2 clear
3 clc
4
5 R1 =22*10^3
6 Rf=1000
7 RL =10*10^3
8 Ii=10*10^ -6
9
10 Ai=1+R1/Rf
11 Io=Ai*Ii
12 Io=Io *10^6
13 printf( Cur r ent I o= %f uA, Io)
14
15 Io=Io /10^6
16 Vmax=Io*RL + Ii*R1
17 printf(\nVmax= %. 2 f V, Vmax)
18 printf(\nHence out put c l i p p i n g doe s not oc c ur )
Scilab code Exa 4.6 voltage to current converter with oating load
36
1 // Example 4 . 6 , Page No192
2 clear
3 clc
4
5 Rf =10*10^3
6 RL=2000
7 Vi=0.5
8
9 IL=Vi/Rf
10 IL=IL *10^6
11 printf( Cur r ent IL= %d uA, IL)
12
13 IL=IL /10^6
14 Vmax=IL*RL + IL*Rf
15 printf(\nVmax= %. 2 f V, Vmax)
16 printf(\nHence out put c l i p p i n g doe s not oc c ur )
Scilab code Exa 4.7 summing amplier
1 // Example 4 . 7 , Page No194
2 clear
3 clc
4
5 V1=2
6 V2=3
7 V3=4
8 Rf=1000
9 R1=Rf
10 R2=Rf
11 R3=Rf
12 R=Rf
13
14 Vo=-(Rf/R1)*(V1+V2+V3)
15 printf(Vo= %d V, Vo)
37
Scilab code Exa 4.8 input impedence
1 // Example 4 . 8 , Page No201
2 clear
3 clc
4
5 // Thi s i s a t h e o r o t i c a l probl em
6
7 // ( Vi 0) /R1 = ( Vi 0) /R2
8 // ( Vo0) /2R1 = ( Vi 0) /R2
9 //Vi / R2=Vo/2R1
10 // Hence , Vo=2Vi
11
12 // I i =(ViVo) /R3 + ( Vi 0) /R1
13 printf( Hence t he i nput i mpedence o f c i r c u i t Ri=R1
R3/( R3R1) )
Scilab code Exa 4.9 practical integrator circuit
1 // Example 4 . 9 , Page No207
2 clear
3 clc
4
5 R1 =10*10^3
6 Rf =100*10^3
7 Cf=10*10^ -9
8
9 fa =1/(2* %pi*Rf*Cf)
10 printf( f a= %d Hz, fa)
38
Scilab code Exa 4.10 design a dierentiator
1 // Example 4 . 1 0 , Page No210
2 clear
3 clc
4
5 fa =1*10^3
6 C1=1*10^ -6
7
8 Rf =1/(2* %pi*fa*C1)
9 Rf=Rf/100
10 printf(Rf= %. 2 f kohm, Rf)
Scilab code Exa 4.11 design a dierentiator using opamp
1 // Example 4 . 1 1 , Page No213
2 clear
3 clc
4
5 fa=200
6 fmax=fa
7
8 C1=0.1*10^ -6
9 Rf =1/(2* %pi*fa*C1)
10 Rf=Rf /1000
11 printf(Rf= %. 3 f kohm, Rf)
12
13 fb=10*fa
14 R1 =1/(2* %pi*fb*C1)
15 R1=R1 /1000
16 printf(\nR1= %. 3 f kohm, R1)
17
18 Cf=R1*C1/Rf
19 Cf=Cf *10^6
20 printf(\nCf= %. 2 f uF, Cf)
39
Scilab code Exa 4.12 solving dierential equation using opamp
1 // Example 4 . 1 2 , Page No223
2 clear
3 clc
4
5 // Thi s i s t h e o r o t i c a l probl em
Scilab code Exa 4.13 transfer function using opamp
1 // Example 4 . 1 3 , Page No226
2 clear
3 clc
4
5 // TF i s H( S)= 4/( s 2 + 3. 3 s + 0 . 9 )
6 // Thi s i s a t h e o r o t i c a l probl em
40
Chapter 5
Operational Amplier
Nonlinear Circuits
Scilab code Exa 5.1 transfer characteristics of comparator
1 // Example 5 . 1 , Page No234
2 clear
3 clc
4
5 Vz1 =5.5
6 Vz2 =5.5
7 Aol =100000
8 Vd=0.7
9 Vo=Vz1+Vd // Pl us or mi nus
10 Vich=Vo/Aol
11 Vich=Vich *1000
12 printf( Del t a Vi=%. 3 f mV , Vich)
Scilab code Exa 5.2 inverting schmitt trigger
1 // Example 5 . 2 , Page No239
41
2 clear
3 clc
4
5 R1 =56*10^3
6 R2=150
7 Vi=1
8 f=50
9 Vsat =13.5
10 Vref=0
11
12 Vut=Vsat*R2/(R1+R2)
13 Vut=Vut *1000
14 printf( Vut= %d mV , Vut)
15 VL=-Vut
16 printf( \nVL= %d mV , VL)
Scilab code Exa 5.3 clipper circuit
1 // Example 5 . 3 , Page No249
2 clear
3 clc
4
5 Vclipl =0.35
6 Vp=0.5
7 gain =10
8 R=1000
9
10 Vounclip=Vp*gain
11 printf( When uncl i pped , out put v o l t a g e= %. 1 f V ,
Vounclip)
12 Voclip=Vclipl*gain
13 printf( \nWhen c l i ppe d , out put v o l t a g e= %. 1 f V ,
Voclip)
14 Vb=Voclip -0.7
15 printf( \ nZener di ode breakdown v o l t a g e= %. 1 f V , Vb
42
)
16 printf( \nA 2 . 8V Zener di ode s houl d be c onne c t e d )
Scilab code Exa 5.4 negative clamping circuit
1 // Example 5 . 4 , Page No251
2 clear
3 clc
4
5 Vref =1.5
6
7 // Part A
8 Vpp=5
9 Vnp =2.5
10 Vc=Vnp + Vref
11 printf( \ nCapac i t or v o l t a g e Vc= %. 1 f V , Vc)
12
13 // Part B
14 Vopeak=Vnp + Vref +Vpp
15 printf( \nPeak val ue o f cl amped out put v o l t a g e Vo(
peak )= %. 1 f V , Vopeak)
16
17 // Part C
18 Voc =0.7 + Vref
19 printf( \nOpamp out put v o l t a g e dur i ng c har gi ng Vo=
%. 1 f V , Voc)
20
21 // Part D
22 Vd=Vref -Vopeak
23 printf( \nMaximum d i f f e r e n t i a l i nput v o l t a g e Vd= %. 1
f V , Vd)
43
Chapter 6
Active Filters
Scilab code Exa 6.1 rst order low pass butterworth lter
1 // Example 6 . 1 , Page No269
2 clear
3 clc
4
5 fH =10*10^3
6 f=12*10^3
7 t=(f^2/fH^2)
8 Hif =1/( sqrt (1+t))
9 Hifdb =20* log(Hif)/log (10)
10 printf( Del t a Vi=%. 2 f dB , Hifdb)
Scilab code Exa 6.2 rst order low pass lter
1 // Example 6 . 2 , Page No270
2 clear
3 clc
4
5 fh=2000
44
6 A=2
7 C=0.01*10^ -6
8 R=1/(2* %pi*fh*C)
9 R=R/1000
10 printf( R= %. 3 f kohm , R)
11 // Rf /Ri=A1
12 printf( \n Hence Rf=Ri =10kohm )
Scilab code Exa 6.3 second order low pass butterworth lter
1 // Example 6 . 3 , Page No272
2 clear
3 clc
4
5 fh =10*10^3
6 f=12*10^3
7 RC =1/(2* %pi*fh)
8 R=200*10^3
9 C=RC/R
10 C3 =1.414*C
11 C4 =0.707*C
12
13 t=(f^4/fh^4)
14 Hif =1/( sqrt (1+t))
15 Hifdb =20* log(Hif)/log (10)
16 printf( Hi f= %. 2 f dB , Hifdb)
Scilab code Exa 6.4 second order low pass butterworth lter with upper-
cuto frequency
1 // Example 6 . 4 , Page No275
2 clear
3 clc
45
4
5 N=2
6 fh =2*10^3
7 C=0.1*10^ -6
8 R=1/(2* %pi*fh*C)
9 Rkohm=R/1000
10 printf( R= %. 1 f kohm , Rkohm)
11 alpha =1.414
12 A=3-alpha
13 RfbyRi=A-1
14 printf( \nRf /Ri= %. 3 f , RfbyRi)
15 printf( \nHence , t ake Rf =5. 86 kohm and Ri =10 kohm )
Scilab code Exa 6.5 third order low pass butterworth lter
1 // Example 6 . 5 , Page No276
2 clear
3 clc
4
5 fh =10*10^3
6 f=12*10^3
7
8 // For t hi r d or de r l ow pas s but t e r wor t h f i l t e r
9 t=(f^6/fh^6)
10 Hif =1/( sqrt (1+t))
11 Hifdb =20* log(Hif)/log (10)
12 printf( Hi f= %. 4 f dB , Hifdb)
13
14 // For f o ur t h or de r l ow pas s but t e r wor t h f i l t e r
15 t=(f^8/fh^8)
16 Hif =1/( sqrt (1+t))
17 Hifdb =20* log(Hif)/log (10)
18 printf( \ nHi f= %. 2 f dB , Hifdb)
46
Scilab code Exa 6.6 fourth order low pass butterworth lter
1 // Example 6 . 6 , Page No276
2 clear
3 clc
4
5 N=2
6 fh=2000
7 C=0.1*10^ -6
8 R=1/(2* %pi*fh*C)
9 Rkohm=R/1000
10 printf( R= %. 1 f kohm , Rkohm)
11
12 alpha1 =0.765
13 alpha2 =1.848
14 A1=3-alpha1
15 A2=3-alpha2
16
17 Rf1byRi1=A1 -1
18 Rf2byRi2=A2 -1
19
20 printf( \nRf1/ Ri 1= %. 3 f , Rf1byRi1)
21 printf( \nHence , t ake Rf1 =12. 35 kohm and Ri 1=10 kohm
)
22 printf( \nRf2/ Ri 2= %. 3 f , Rf2byRi2)
23 printf( \nHence , t ake Rf2 =15. 2 kohm and Ri 2=100 kohm
)
Scilab code Exa 6.7 rst order high pass lter
1 // Example 6 . 7 , Page No279
2 clear
47
3 clc
4
5 A=2
6 fL =2*10^3
7 C=0.01*10^ -6
8 R=1/(2* %pi*fL*C)
9 Rkohm=R/1000
10 printf( R= %. 1 f kohm , Rkohm)
11
12 RfbyRi=A-1
13 printf( \nRf /Ri= %. 3 f , RfbyRi)
14 printf( \nHence , t ake Rf =10 kohm and Ri =10 kohm )
Scilab code Exa 6.8 second order high pass butterworth lter variable gain
1 // Example 6 . 8 , Page No282
2 clear
3 clc
4
5 R2 =16*10^3
6 R3 =16*10^3
7 Rf =15.8*10^3
8 Ri =27*10^3
9 C2 =0.01*10^ -6
10 C3 =0.01*10^ -6
11 fL =1/(2* %pi*sqrt(R2*R3*C2*C3))
12 fL=fL /1000
13 printf( \ nf L= %. 1 f kHz , fL)
14
15 A=1+Rf/Ri
16 printf( \nA= %. 3 f , A)
Scilab code Exa 6.9 fourth order high pass butterworth lter
48
1 // Example 6 . 9 , Page No284
2 clear
3 clc
4
5 fh =50000
6 C=0.001*10^ -6
7 R=1/(2* %pi*fh*C)
8 Rkohm=R/1000
9 printf( R= %. 3 f kohm , Rkohm)
10
11 R1=R/1.082
12 R2=R/0.9241
13 R3=R/2.613
14 R4=R/0.3825
15 printf( \nR1= %. 3 f kohm , R1 /1000)
16 printf( \nR2= %. 3 f kohm , R2 /1000)
17 printf( \nR3= %. 3 f kohm , R3 /1000)
18 printf( \nR4= %. 3 f kohm , R4 /1000)
19 Hif =0.02
20 s=(Hif^2)/(1-Hif^2)
21 s1=s^0.125
22 f=fh /1.6815 * s1
23 fkhz=f/1000
24 printf( \ nf= %. 2 f kHz , fkhz)
Scilab code Exa 6.10 bandpass lter
1 // Example 6 . 1 0 , Page No286
2 clear
3 clc
4
5 fh=2500
6 fL=250
7 B=fh -fL
8 printf( Bandwdth B= %d Hz , B)
49
9
10 fr=sqrt(fh*fL)
11 printf( \ nResonant Frequency f r= %. 2 f Hz , fr)
12
13 fc=(fL+fh)/2
14 printf( \ nCenter Frequency f r= %d Hz , fc)
15 printf( \nHence , r e s onant f r e que nc y i s al ways l e s s
than c e nt e r f r e que nc y )
Scilab code Exa 6.11 bandpass lter with resonant frequency
1 // Example 6 . 1 1 , Page No286
2 clear
3 clc
4
5 // Part A
6 fr=1000
7 B=3000
8 Q=fr/B
9 printf( Qual i t y f a c t o r Q= %. 2 f , Q)
10 printf( Si nc e Q<0. 5 , t h i s i s a wi deband f i l t e r )
11
12 // Part B
13 fL= sqrt((B*B/4)+fr^2) - B/2
14 printf( \ nf L= %. 2 f Hz , fL)
15
16 // Part C
17 fh=fL+B
18 printf( \ nf h= %. 2 f Hz , fh)
Scilab code Exa 6.12 narrowband bandpass lter
1 // Example 6 . 1 2 , Page No288
50
2 clear
3 clc
4
5 // Part A
6 // For a bandpass f i l t e r
7 R=20000
8 Rr=2700
9 C=0.01*10^ -6
10
11 fr =0.1125*( sqrt (1+R/Rr))/(R*C)
12 printf( Resonant f r e que nc y= %. 1 f Hz , fr)
13
14 // Part B
15 B=0.1591/(R*C)
16 printf( \nBandwi dth= %. 1 f Hz , B)
Scilab code Exa 6.13 narrowband bandpass lter with resonant frequency
1 // Example 6 . 1 3 , Page No289
2 clear
3 clc
4
5 fr=200
6 B=20
7 C=0.33*10^ -6
8 Q=fr/B
9
10 R=0.1591/(B*C)
11 Rr=R/(2*Q*Q-1)
12 R=R/1000
13 printf( \nR= %. 1 f kohm , R)
14 printf( \nRr= %. 1 f ohm , Rr)
51
Scilab code Exa 6.14 clock frequency
1 // Example 6 . 1 4 , Page No307
2 clear
3 clc
4
5 R=1*10^6
6 C=40*10^ -12
7 fck =1/(R*C)
8 fck=fck /1000
9 printf( Fck= %. 1 f kHz , fck)
52
Chapter 7
Waveform Generators
Scilab code Exa 7.1 RC Phase shift oscillator
1 // Example 7 . 1 , Page No324
2 clear
3 clc
4
5 f=300
6 C=0.1*10^ -6
7 t=f*C
8 R=1/(2* %pi*t*sqrt (6))
9 R=R/1000
10 printf( R= %. 2 f kohm , R)
11 printf( \ nLet R=2. 2 kohm , hence R1=22 kohm )
12 R1 =22000
13 Rf=29*R1
14 Rf=Rf /1000
15 printf( \nRf= %d kohm , Rf)
Scilab code Exa 7.2 Wien bridge oscillator
53
1 // Example 7 . 2 , Page No326
2 clear
3 clc
4
5 f=2000
6 C=0.05*10^ -6
7 t=f*C
8 R=1/(2* %pi*t)
9 R=R/1000
10 printf( R= %. 3 f kohm , R)
11 printf( \ nLet R=1. 8 kohm )
12 R1=1800
13 Rf=2*R1
14 Rf=Rf /1000
15 printf( \nRf= %d kohm , Rf)
16 printf( \ nStandard val ue Rf= 3 . 3 kohm )
Scilab code Exa 7.3 Astable multivibrator
1 // Example 7 . 3 , Page No329
2 clear
3 clc
4
5 R1 =116*10^3
6 R2 =100*10^3
7 Vsat =14
8
9 // Part A
10 f=1000
11 T=1/f
12 // As l o g val ue i s approx 1
13 RC=T/2
14 RC1=RC*1000
15 printf( RC= %. 1 f 103 s e c , RC1)
16
54
17 // Part B
18 C=0.01*10^ -6
19 R=RC/C
20 Rn=R/1000
21 printf( \nR= %d kohm , Rn)
22
23 // Part C
24 Vmax =2* Vsat*(R2/(R1+R2))
25 printf( \nMaximum val ue o f d i f f e r e n t i a l i nput
v o l t a g e= %. 2 f V , Vmax)
Scilab code Exa 7.4 Square wave oscillator
1 // Example 7 . 4 , Page No330
2 clear
3 clc
4
5 fo=1000
6 Vcc =12
7 R1 =10*10^3
8 R2 =10*10^3
9 C=0.1*10^ -6
10 R=1/(2.2*C*fo)
11 R=R/1000
12 printf( R= %. 3 f kohm , R)
Scilab code Exa 7.5 Triangular wave generator
1 // Example 7 . 5 , Page No334
2 clear
3 clc
4
5 R1 =100*10^3
55
6 R2 =10*10^3
7 R3 =20*10^3
8 C1 =0.01*10^ -6
9 Vsat =14
10
11 // Part A
12 T=4*R1*R2*C1/R3
13 Tn=T*1000
14 printf( Time pe r i o d T= %d ms , Tn)
15
16 // Part B
17 f=1/T
18 printf( \ nf r e que nc y f= %d Hz , f)
19
20 // Part C
21 printf( \nPeak val ue i s +14V and 14V )
22
23 // Part D
24 Vp=R2*Vsat/R3
25 printf( \ nTr i angul ar wave o s c i l l a t e s between %d V
and %d V , Vp, Vp)
Scilab code Exa 7.6 Sawtooth wave generator
1 // Example 7 . 6 , Page No336
2 clear
3 clc
4
5 Ri =10*10^3
6 Vp=10
7 Vref =10
8 fo=200
9 C1=0.1*10^ -6
10 Vi=2
11 t=Vi/Vref
56
12 f=t/(Ri*C1)
13 printf( Frequency f= %d Hz , f)
Scilab code Exa 7.7 Monostable multivibrator
1 // Example 7 . 7 , Page No345
2 clear
3 clc
4
5 // Answer i n t e xt book i s wrong
6 C=0.1*10^ -6
7 t=1*10^ -3
8 R=t/(1.22*C)
9 R=R/1000
10 printf( R= %. 1 f kohm , R)
Scilab code Exa 7.8 Frequency of oscillation
1 // Example 7 . 8 , Page No351
2 clear
3 clc
4
5 D=20 // 20 pe r c e nt
6 Ton =1*10^ -3
7 Tonpoff =100* Ton/D
8 Tonpoff1=Tonpoff *1000
9 printf( Ton + Tof f= %d ms , Tonpoff1)
10 f=1/ Tonpoff
11 printf( \ nFrequency o f o s c i l l a t i o n= %d Hz , f)
57
Scilab code Exa 7.9 Astable multivibrator
1 // Example 7 . 9 , Page No351
2 clear
3 clc
4
5 D=0.7
6 f=1000
7
8 RB =10^4/(0.693*10/3)
9 RA=4*RB/3
10 RB1=RB/1000
11 printf( RB= %. 1 f kohm , RB1)
12 RA1=RA/1000
13 printf( \nRA= %. 1 f kohm , RA1)
14 printf( \n Answers i n t e xt books ar e wrong )
Scilab code Exa 7.10 Teletypewriter
1 // Example 7 . 1 0 , Page No352
2 clear
3 clc
4
5
6 f1=1070
7 RA =50000
8 C=0.01*10^ -6
9 Rc=76 // Standard Val ue
10 t=1.45/( f1*C)
11 RB=(t-RA)/2
12 printf( Assumi ng RA= 50 kohm and C= 0. 01 uF )
13 RB=RB /1000
14 printf( \nHence , RB= %. 2 f kohm , RB)
15 printf( \nRc= %d ohm ( Standard Val ue ) , Rc)
58
Chapter 8
Voltage Regulators
Scilab code Exa 8.1 Linear Voltage Regulator
1 // Example 8 . 1 , Page No362
2 clear
3 clc
4
5 Vo=15
6 Vimin=Vo+3
7
8 Vr=2
9 Vi=Vimin + Vr/2
10
11 Vz=Vi/2
12 printf( As Vz=%. 1 f , us e Zener di ode 1N758 f o r 10V ,
Vz)
13
14 Vz=10
15 Iz=20*10^ -3
16
17 R1=(Vi-Vz)/Iz
18 printf( \nR1= %d ohm , R1)
19 I2=50*10^ -6
20 R2=(Vo-Vz)/I2
59
21 R2=R2 /1000
22 printf( \nR2= %. 1 f kohm , R2)
23
24 R3=Vz/I2
25 R3=R3 /1000
26 printf( \nR3= %d kohm , R3)
27 printf( \ nSe l e c t C1= 50uF )
28 Vcemax=Vi+Vr/2
29 IE=50*10^ -6
30 IL=50*10^ -6
31 P=(Vi-Vo)*IL
32 P1=P*1000000
33 printf( \nP= %. 1 f mW , P1)
34 printf( \nUse t he t r a n s s t o r 2N718 f o r Q1 )
Scilab code Exa 8.2 7805 Voltage Regulator
1 // Example 8 . 2 , Page No366
2 clear
3 clc
4
5 IL=0.25
6 Vr=5
7 R=Vr/IL
8 printf( R= %d ohm , R)
9 RL=10
10 VL=IL*RL
11
12 Vo=Vr+VL
13 printf( \nVo= %. 1 f V , Vo)
14 Vdrop=2
15 Vi=Vo+Vdrop
16 printf( \nVo= %. 1 f V , Vi)
60
Scilab code Exa 8.3 7805 Regulator Circuit
1 // Example 8 . 3 , Page No368
2 clear
3 clc
4 VL=5
5 RL=100
6 IL=VL/RL
7 IL1=IL*1000
8 printf( Part A )
9 printf( \nLoad Cur r ent IL= %d mA , IL1)
10 R1=7
11 VR1=IL*R1
12 VR1x=VR1 *1000
13 printf( \ nVol t age a c c r o s s R1= %d mV , VR1x)
14 printf( \nAs v o l t a g e < 0 . 7V, Q1 i s OFF )
15 printf( \nHence IL=I o=I i =50 mA )
16
17 printf( \n\ nPart B )
18 VLb=5
19 RLb=2
20 ILb=VLb/RLb
21 printf( \nLoad Cur r ent IL= %. 1 f A , ILb)
22 R1=7
23 VR1=ILb*R1
24 printf( \ nVol t age a c c r o s s R1= %. 1 f mV , VR1)
25 printf( \nAs v o l t a g e > 0 . 7V, Q1 i s ON )
26 Io =0.147
27 Ic=ILb -Io
28 printf( \nHence I c= %. 3 f A , Ic)
Scilab code Exa 8.4 LM317 Regulator
61
1 // Example 8 . 4 , Page No371
2 clear
3 clc
4
5 R1=240
6 R2=2000
7 Iadj =50*10^ -6
8 Vref =1.25
9
10 Vo=(Vref *(1+R2/R1))+(Iadj*R2)
11 printf( Vo= %. 2 f V , Vo)
Scilab code Exa 8.5 Voltage regulator using LM317
1 // Example 8 . 5 , Page No371
2 clear
3 clc
4
5 Iadjmax =100*10^ -6
6 R1=240
7 Vref =1.25
8
9 // Fi r s t c as e : Vo=4
10 Vo=4
11 R2a1=(Vo-Vref)/(Vref/R1 + Iadjmax)
12 R2a=R2a1 /1000
13 printf( \nR2= %. 2 f kohm , R2a)
14
15 // Fi r s t c as e : Vo=12
16 Vo=12
17 R2b1=(Vo-Vref)/(Vref/R1 + Iadjmax)
18 R2b=R2b1 /1000
19 printf( \nR2= %. 2 f kohm , R2b)
62
Scilab code Exa 8.6 Current Limiting Circuit
1 // Example 8 . 6 , Page No377
2 clear
3 clc
4
5 ILmax =0.5
6
7 // Part 1
8 Rsc =0.7/ ILmax
9 printf( Rsc= %. 1 f ohm , Rsc)
10
11 // Part 2
12 RL=100
13 Vo=20
14 IL=Vo/RL
15 printf( \nIL= %. 1 f A , IL)
16
17 // Part 3
18 RLn =10
19 IL=Vo/RLn
20 printf( \nIL= %. 1 f A , IL)
21 printf( \ nSi nc e IL > ILmax o f 0 . 5A, c ur r e nt l i mi t i n g
wi l l happen )
22 Von=RLn*ILmax
23 printf( \nVo= %. 1 f V , Von)
Scilab code Exa 8.7 LM723 Regulator
1 // Example 8 . 7 , Page No378
2 clear
3 clc
63
4
5 R2 =10000
6 Vo=12
7 Vref =7.15
8
9 R1=(Vo/Vref)*R2 - R2
10 R1a=R1/1000
11 printf( \nR1= %. 2 f kohm , R1a)
Scilab code Exa 8.8 Continuously adjustable power supply
1 // Example 8 . 8 , Page No380
2 clear
3 clc
4
5 Vref =7.15
6 Vo=5
7 k=Vref/Vo
8 printf( ( R1b+R2) /R2= %. 2 f , k)
9 k1=k-1
10 printf( \nR1 = %. 2 f R2 , k1)
11
12 // For min v o l t a g e o f 2V
13 Vom=2
14 km=Vref/Vom
15 printf( \n( R1a+R1b+R2) /R2= %. 3 f , km)
16 km1=km -1.43
17 printf( \nR1a = %. 3 f R2 , km1)
18
19 R1a =10000
20 R1b =2000
21 R2=R1a /2.145
22 R2n=R2/1000
23 printf( \nR2= %. 2 f kohm , R2n)
24 R1=6000
64
25 R3=(R1*R2)/(R1+R2)
26 R3n=R3/1000
27 printf( \nR3= %. 2 f kohm , R3n)
65
Chapter 9
Analog Multipliers
Scilab code Exa 9.1 DC Component
1 // Example 9 . 1 , Page No411
2 clear
3 clc
4
5 // Part 1
6 th1=acos (0)
7 th=th1 *180/ %pi
8 printf( Theta= + or %d de gr e e , th)
9
10 // Part 2
11 Vodc =4.47*4.47* cos(th1)/20
12 // For t he t a=+/30 deg
13 Vodc1=cos (30* %pi /180)
14 printf( \nVodc f o r 30 de gr e e= %. 3 f V , Vodc1)
15 // For t he t a=+/45 deg
16 Vodc2=cos (45* %pi /180)
17 printf( \nVodc f o r 45 de gr e e= %. 3 f V , Vodc2)
18 // For t he t a=+/60 deg
19 Vodc3=cos (60* %pi /180)
20 printf( \nVodc f o r 60 de gr e e= %. 1 f V , Vodc3)
66
Chapter 10
Phase Locked Loop
Scilab code Exa 10.1 DC Control voltage
1 // Example 1 0 . 1 , Page No429
2 clear
3 clc
4
5 fs =20000
6 fr =21000
7 VCOf =4000
8 Vcd=(fr -fs)/VCOf
9 printf( Vcd= %. 2 f V , Vcd)
Scilab code Exa 10.2 VCO Circuit
1 // Example 1 0 . 2 , Page No430
2 clear
3 clc
4
5 // Part A
6 R1 =15*10^3
67
7 R3 =15*10^3
8 R2 =2.2*10^3
9 C1 =0.001*10^ -6
10 Vcc =12
11 Vc=Vcc*(R3/(R2+R3))
12 printf( \nVc= %. 3 f V , Vc)
13 fo1 =2*(Vcc -Vc)/(C1*R1*Vcc)
14 fo1n=fo1 /1000
15 printf( \nFo= %. 2 f kHz , fo1n)
16
17 // Part B
18 Vc1=7
19 fo2 =2*(Vcc -Vc1)/(C1*R1*Vcc)
20 fo2n=fo2 /1000
21 printf( \nFo= %. 3 f kHz , fo2n)
22 Vc2=8
23 fo3 =2*(Vcc -Vc2)/(C1*R1*Vcc)
24 fo3n=fo3 /1000
25 printf( \nFo= %. 3 f kHz , fo3n)
26
27 fch=fo2n -fo3n
28 printf( \nChange i n out put f r e que nc y= %. 3 f kHz , fch
)
Scilab code Exa 10.3 PLL565
1 // Example 1 0 . 3 , Page No438
2 clear
3 clc
4
5 fo =100*10^3
6 C=2*10^ -6
7 Vcc=6
8
9 fld =7.8* fo/(2* Vcc)
68
10 fldn=fld /1000
11 printf( \ nDel t a FL= +/ %d kHz , fldn)
12 LR=2* fldn
13 printf( \nLock Range= %d kHz , LR)
14
15 fcd=sqrt(fld/(C*2*%pi *3.6*10^3))
16 fcdn=fcd /1000
17 printf( \ nDel t a FC= +/ %. 3 f kHz , fcdn)
18 CR=2* fcdn
19 printf( \ nCapture Range= %. 3 f kHz , CR)
20
21 R1 =12*10^3
22 C1 =1.2/(4* R1*fo)
23 C1n=C1 *10^12
24 printf( \nC1= %d pF , C1n)
Scilab code Exa 10.4 IC565
1 // Example 1 0 . 4 , Page No438
2 clear
3 clc
4
5 R1 =15000
6 C1 =0.01*10^ -6
7 C=1*10^ -6
8 V=12
9 fo =1.2/(4* R1*C1)
10 fon=fo*10^-3
11 printf( \ nCentre f r e que nc y o f VCO i s = %. 2 f kHz , fon
)
12
13 LR=7.8*fo/V
14 LR1=LR/1000
15 printf( \nLock Range = +/ %. 1 f kHz , LR1)
16 fcd=sqrt(LR/(C*2*%pi *3.6*1000))
69
17 printf( \ nDel t a FC= %. 2 f Hz , fcd)
Scilab code Exa 10.5 IC565 Output frequency
1 // Example 1 0 . 5 , Page No439
2 clear
3 clc
4
5 C1 =470*10^ -12
6 C=20*10^ -6
7 V=12
8 R1 =15000
9 fo =1.2/(4* R1*C1)
10 fon=fo/1000
11 printf( \ nCentre f r e que nc y o f VCO i s = %. 3 f kHz , fon
)
12
13 LR=7.8*fo/V
14 LR1=LR/1000
15 printf( \nLock Range = +/ %. 2 f kHz , LR1)
16 fcd=sqrt(LR/(C*2*%pi *3.6*1000))
17 printf( \ nDel t a FC= +/ %. 2 f Hz , fcd)
Scilab code Exa 10.6 PLL
1 // Example 1 0 . 6 , Page No439
2 clear
3 clc
4
5 fr=300
6 bw=50
7 ip=320
8 pdop=fr+ip
70
9 printf( \ nPhase de t e c t o r out put= %d kHz , pdop)
10 difr=ip-fr
11 printf( \ n Di f f e r e n c e Frequency= %d kHz , difr)
12 printf( \nAs Bandwi dth i s g r e a t e r than d i f f e r e n c e
f r e que nc y , )
13 printf( \nPLL can a c q ui r e l o c k )
Scilab code Exa 10.7 IC565 as FM modulator
1 // Example 1 0 . 7 , Page No440
2 clear
3 clc
4
5 C1 =0.01*10^ -6
6 C=0.04*10^ -6
7 V=12
8 R1 =10000
9 fo =120/(4* R1*C1)
10 fon=fo/1000
11 printf( \ nCentre f r e que nc y o f VCO i s = %. 1 f kHz , fon
)
12
13 fld =7.8* fo/(V)
14 fldn=fld /1000
15 printf( \nLock Range= %d kHz , fldn)
16
17 fcd=sqrt(fld/(C*2*%pi *3.6*10^3))
18 fcdn=fcd /1000
19 printf( \ nCapture Range= %. 2 f kHz , fcdn)
71
Chapter 11
DAC and ADC
Scilab code Exa 11.1 Resolution
1 // Example 1 1 . 1 , Page No460
2 clear
3 clc
4
5 n=12
6 lv=2^n
7 Vo=4
8 st =10^6* Vo/lv
9 printf( \ nStep Si z e= %d uV , st)
10
11 dr=Vo/(st*10^ -6)
12 printf( \nDynamic Range= %d , dr)
13 drdb =20* log10(dr)
14 printf( \nDynamic Range= %d dB , drdb)
Scilab code Exa 11.2 DAC resolution
1 // Example 1 1 . 2 , Page No460
72
2 clear
3 clc
4
5 n=8
6 lv=2^n - 1
7 Vo=2.55
8 st =10^3* Vo/lv
9 printf( \ nStep Si z e= %d mV , st)
Scilab code Exa 11.3 Ladder type DAC
1 // Example 1 1 . 3 , Page No460
2 clear
3 clc
4
5 n=4
6 R=10000
7 Vr=10
8 // Part A
9 reso=Vr *10^6/(R*2^n)
10 printf( \ nRe s ol ut i on o f 1 LSB= %. 1 f uA , reso)
11
12 // Part B
13 k=bin2dec( 1101 )
14 Io=reso*k/1000
15 printf( \nOutput I o f o r d i g i t a l i nput 1101= %. 4 f uA
, Io)
Scilab code Exa 11.4 8bit DAC
1 // Example 1 1 . 4 , Page No461
2 clear
3 clc
73
4
5 reso =10
6 // Part A
7 k1=bin2dec( 10001010 )
8 Vo=k1*reso
9 Von=Vo/1000
10 printf( \nVo= %. 2 f V , Von)
11
12 // Part B
13 k2=bin2dec( 000100000 )
14 Vo1=k2*reso
15 Von1=Vo1 /1000
16 printf( \nVo= %. 2 f V , Von1)
Scilab code Exa 11.5 4bit converter
1 // Example 1 1 . 5 , Page No463
2 clear
3 clc
4
5 // Part A
6 printf( \ nPart A )
7 R=10000
8 Vr=10
9 n=4
10 lsb =0.5
11 Rf=(R*2^n)*lsb/Vr
12 Rfn=Rf/1000
13 printf( \nRf= %d kohm , Rfn)
14
15 printf( \ nPart B )
16 b1=1
17 Rf1=R*6/(Vr*lsb)
18 Rfn1=Rf1 /1000
19 printf( \nRf= %d kohm , Rfn1)
74
20
21 printf( \ nPart C )
22 Vfs =12
23 Rf2=R*Vfs/Vr
24 Rfn2=Rf2 /1000
25 printf( \nRf= %d kohm , Rfn2)
26 printf( \ nPart D )
27 Vfs1 =10
28 bb =0.9375
29 Rf3=R*Vfs1/(Vr*bb)
30 Rfn3=Rf3 /1000
31 printf( \nRf= %. 3 f kohm , Rfn3)
Scilab code Exa 11.6 Inverted R2R ladder
1 // Example 1 1 . 6 , Page No466
2 clear
3 clc
4
5 Vr=10
6 R=10*10^3
7 I1=Vr/(2*R)
8 I1n=I1*1000
9 printf( \ nI 1= %. 1 f mA , I1n)
10 I2=I1/2
11 I2n=I2*1000
12 printf( \ nI 2= %. 2 f mA , I2n)
13 I3=I1/4
14 I3n=I3*1000
15 printf( \ nI 3= %. 2 f mA , I3n)
16
17 Io=I1+I2+I3
18 Ion=Io*1000
19 printf( \ nI o= %. 3 f mA , Ion)
20
75
21 Vo=-1*Io*R
22 printf( \nOutput Vol t age Vo= %. 2 f V , Vo)
Scilab code Exa 11.7 Output voltage for digital input
1 // Example 1 1 . 7 , Page No473
2 clear
3 clc
4
5 lsb =8*10^ -6
6 Ifs=lsb *255
7 R=5000
8 ip1= bin2dec( 00000000 )
9 Io1=ip1*lsb
10 Io1d=Ifs -Io1
11 Vo=-Io1d*R
12 printf( \nCase 1 : Vo= %. 2 f V , Vo)
13
14 ip2= bin2dec( 01111111 )
15 Io2=(ip2*lsb)*1000
16 Io2d=Ifs*1000-Io2
17 Vo2=-(Io2d*R)/1000
18 printf( \nCase 2 : Vo= 0. 04 V )
19
20 ip3= bin2dec( 10000000 )
21 Io3=ip3*lsb
22 Io3d=Ifs -Io3
23 Vo3=-Io3d*R
24 printf( \nCase 3 : Vo= 0. 04 V )
25
26 ip4= bin2dec( 111111111 )
27 Io4=ip4*lsb
28 Io4d=Ifs -Io4
29 Vo4=Io1d*R
30 printf( \nCase 4 : Vo= %. 2 f V , Vo4)
76
Scilab code Exa 11.8 Resolution and dynamic range
1 // Example 1 1 . 8 , Page No478
2 clear
3 clc
4
5 n=16
6 lv=2^n
7 V=2
8 st=V/lv
9 lvn=st*10^6
10 printf( \ nStep Si z e= %. 2 f uV , lvn)
11 dr=20* log10(lv)
12 printf( \nDynamic Range= %d dB , dr)
Scilab code Exa 11.9 8bit ADC
1 // Example 1 1 . 9 , Page No482
2 clear
3 clc
4
5 Vm=10
6 n=8
7 lv=2^n
8 lsb=Vm/lv
9 lsbn= lsb *1000
10 printf( \ nPart A: 1 LSB= %. 1 f mV , lsbn )
11
12 Vifs=Vm-lsb
13 printf( \ nPart B: Vi f s= %. 3 f V , Vifs )
14
77
15 ip=4.8
16 d=1+ ip/lsb
17 printf( \ nPart C: D= %d , d)
18 d=123
19 op=dec2bin(d,8)
20 printf( \n Di g i t a l Output= %s , op)
Scilab code Exa 11.10 Successive approximation ADC
1 // Example 1 1 . 1 0 , Page No494
2 clear
3 clc
4
5 n=8
6 cl =2*10^6
7 tp=1/cl
8 tpn=tp*10^6
9 printf( \n Time f o r one c l o c k pul s e= %. 1 f uS , tpn)
10 tm=(n+1)*tp
11 tmn=tm*10^6
12 printf( \n Time f o r r e s e t t i n g SAR and c o nve r s i o n= %
. 1 f uS , tmn)
78

You might also like