summaryrefslogtreecommitdiff
path: root/Linear_Integrated_Circuit_by_M._S._Sivakumar/Ch9.ipynb
blob: 5ae5cfbebbb03deb980e149ff71af2bcb9ee94a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9 Phase Locked Loop"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.1 Pg 284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The output voltage of switching regulator circuit is = -0.30  V \n",
      "The output voltage of switching regulator circuit is = 1.50  V \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt, pi\n",
    "# to find output voltage for a constant input signal frequency of 200 KHz\n",
    "fo = 2*pi*1*10**3 # # KHz/V  # VCO sensitivity range 4.1\n",
    "fc = 500  # # Hz a free running frequency\n",
    "f1 = 200 # # Hz  input frequency\n",
    "f2 = 2*10**3 # # Hz  input frequency\n",
    "\n",
    "# the output voltage of PLL is defined as\n",
    "#Vo = (wo-wc)/ko\n",
    "ko = fo #\n",
    "# when i/p locked with o/p wo=wi\n",
    "# Vo = (wi-wc)/ko #\n",
    "\n",
    "#for the i/p frequency fi = 200 Hz\n",
    "fi = 200 #  # Hz\n",
    "Vo = (((2*pi*fi)-(2*pi*fc))/ko)#\n",
    "print 'The output voltage of switching regulator circuit is = %0.2f'%Vo,' V '\n",
    "\n",
    "#for the i/p frequency fi = 200 Hz\n",
    "fi = 2*10**3 #  # Hz\n",
    "Vo = (((2*pi*fi)-(2*pi*fc))/ko)#\n",
    "print 'The output voltage of switching regulator circuit is = %0.2f'%Vo,' V '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.2 Pg 285"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The sum frequency produce by phase detector is = 900.00  KHz \n",
      "The difference frequency produce by phase detector is = 100.00  KHz \n",
      "The phase detector frequencies are outside of the low pass filter\n",
      "The VCO will be in its free running frequency \n"
     ]
    }
   ],
   "source": [
    " # to find VCO output frequency\n",
    "fc = 400  # # KHz a free running frequency\n",
    "f = 10 #  # KHz  low pass filter bandwidth\n",
    "fi = 500 # # KHz  input frequency\n",
    "\n",
    "# In PLL a phase detector produces the sum and difference frequencies are defined as\n",
    "\n",
    "sum = fi+fc #\n",
    "print 'The sum frequency produce by phase detector is = %0.2f'%sum,' KHz '\n",
    "\n",
    "difference = fi-fc #\n",
    "print 'The difference frequency produce by phase detector is = %0.2f'%difference,' KHz '\n",
    "\n",
    "print 'The phase detector frequencies are outside of the low pass filter'#\n",
    "\n",
    "print 'The VCO will be in its free running frequency '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.3 Pg 286"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The sensitivity of phase detector Kd is = 0.45 \n",
      "The maximum control voltage of VCO Vfmax = 1.40  V\n",
      "The maximum frequency swing of VCO = 35.00  KHz\n",
      "The maximum range of frequency which lock a PLL is = 15.00  KHz \n",
      "The maximum range of frequency which lock a PLL is = 85.00  KHz \n",
      "The maximum and minimum rage between 15 KHz to 85 KHZ \n",
      "The lock range is = 70.00  KHz \n"
     ]
    }
   ],
   "source": [
    "# to determine the lock range of PLL\n",
    "Ko = 25 # # KHz\n",
    "fo = 50 # # KHz\n",
    "A = 2 #\n",
    "Vd = 0.7 #\n",
    "AL = 1 #\n",
    "\n",
    "# the amximum output swing of phase detector \n",
    "# Vd = Kd*(pi/2) #\n",
    "\n",
    "# the sensitivity of phase detector Kd is\n",
    "Kd = Vd*(2/pi) #\n",
    "print 'The sensitivity of phase detector Kd is = %0.2f'%Kd,''\n",
    "\n",
    "# The maximum control voltage of VCO Vfmax\n",
    "Vfmax = (pi/2)*Kd*A #\n",
    "print 'The maximum control voltage of VCO Vfmax = %0.2f'%Vfmax,' V'\n",
    "\n",
    "# the maximum frequency swing of VCO\n",
    "fL = (Ko*Vfmax)#\n",
    "print 'The maximum frequency swing of VCO = %0.2f'%fL,' KHz'\n",
    "\n",
    "# The maximum range of frequency which lock a PLL are\n",
    "fi = fo-fL #\n",
    "print 'The maximum range of frequency which lock a PLL is = %0.2f'%fi,' KHz '\n",
    "\n",
    "fi = fo+fL #\n",
    "print 'The maximum range of frequency which lock a PLL is = %0.2f'%fi,' KHz '\n",
    "\n",
    "print 'The maximum and minimum rage between 15 KHz to 85 KHZ '\n",
    "\n",
    "\n",
    "# the lock range is\n",
    "fLock = 2*fL #\n",
    "print 'The lock range is = %0.2f'%fLock,' KHz '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.4 Pg 286"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The current through the control resistor R is = 0.60  mA \n",
      "The charging time of capacitor is = 5.00  msec \n",
      "The total time period of tringular and square wave is = 10.00  msec \n",
      "The output frequency of VCO is = 0.10  KHz \n"
     ]
    }
   ],
   "source": [
    "# to determine the output frequency capacitor charging time of VCO\n",
    "Vcc = 12 #\n",
    "Vcs = 6\n",
    "R = 10 # # K ohm\n",
    "C = 1 # # uF\n",
    "\n",
    "# the current through the control resistor R\n",
    "i =(Vcc-Vcs)/R #\n",
    "print 'The current through the control resistor R is = %0.2f'%i, ' mA '\n",
    "\n",
    "# The charging time of capacitor \n",
    "t = (0.25*Vcc*C)/i #\n",
    "print 'The charging time of capacitor is = %0.2f'%t, ' msec '\n",
    "\n",
    "# In VCO the capacitor charging and discharging time period are equal ,so the total time period of tringular and square wave forms can be written as 2*t #\n",
    "t = ((0.5*Vcc*C)/i)#\n",
    "print 'The total time period of tringular and square wave is = %0.2f'%t, ' msec '\n",
    "\n",
    "# the output frequency of VCO is\n",
    "fo = 1/t #\n",
    "print 'The output frequency of VCO is = %0.2f'%fo, ' KHz '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.5 Pg 287"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The charging or discharging time of capacitor is = 25.00  msec \n",
      "The output frequency of VCO is is = 20.00  Hz \n",
      "The output frequency of VCO is = 625.00  Kohm\n",
      "The current through the control resistor R is = 1.60  uA \n",
      "The capacitor charging current is = 2000.00  V = 0.33Vcc \n"
     ]
    }
   ],
   "source": [
    "# to design VCO with output square wave pulse time of 50 msec\n",
    "Vcc =6 #\n",
    "Vcs = 5 #\n",
    "R = 22 # #K ohm\n",
    "C = 0.02 # # uF\n",
    "t = 50*10**-3 # # sec   output square wave pluse\n",
    "\n",
    "# In VCO the capacitor charging and discharging time period are equal ,so the total time period of tringular and square wave forms can be written as 2*t #\n",
    "\n",
    "\n",
    "# the charging or discharging time of capacitor \n",
    "tcap = t/2*1e3 #\n",
    "print 'The charging or discharging time of capacitor is = %0.2f'%tcap, ' msec '\n",
    "\n",
    "# the output frequency of VCO is\n",
    "fo = 1/t #\n",
    "print 'The output frequency of VCO is is = %0.2f'%fo, ' Hz '\n",
    "\n",
    "# the output frequency of VCO\n",
    " # fo = (1/4*R*C)#\n",
    "R = 1/(4*fo*1e3*C*1e-9)/1e3 # Kohm\n",
    "print 'The output frequency of VCO is = %0.2f'%R, ' Kohm'\n",
    "\n",
    "# the current through the control resistor R\n",
    "i =(Vcc-Vcs)/R*1e3 #\n",
    "print 'The current through the control resistor R is = %0.2f'%i, ' uA '\n",
    "\n",
    "# the capacitor charging current \n",
    "# (V/t)=(i/C) #\n",
    "V = (i/C)*tcap #\n",
    "print 'The capacitor charging current is = %0.2f'%V, ' V = 0.33Vcc '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.6 Pg 289"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The center frequency of VCO is is = 0.17  kHz \n",
      "The lock range of PLL is = 2.67  KHz/V \n",
      "The lock range of PLL is = 25.59 k Hz/V \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "# to determine the center frequency of VCO lock and capture range of PLL\n",
    "R = 15 # # K ohm\n",
    "C = 0.12 # # uF\n",
    "Vcc = 12 #\n",
    "\n",
    "# the center frequency of VCO fo\n",
    "fo = (1.2/4/(R*1e3)/(C*1e-6))/1e3#\n",
    "print 'The center frequency of VCO is is = %0.2f'%fo, ' kHz '\n",
    "\n",
    "fo = 4 # # KHz\n",
    "# the lock range of PLL\n",
    "fL = (8*fo/Vcc) #\n",
    "print 'The lock range of PLL is = %0.2f'%fL, ' KHz/V '\n",
    "\n",
    "# the capture range of PLL\n",
    "fc = ((fo-fL)/(2*pi*3.6*10**3*C*1e-6)**(1/2)) #\n",
    "print 'The lock range of PLL is = %0.2f'%fc, 'k Hz/V '\n",
    "# ans wrong in the textbook."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.7 Pg 290"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The total time period of VCO is = 5.00  usec \n",
      "The charging or discharging time of capacitor is = 2.50  usec \n",
      "The voltage swing of VCO for 12 V supply is = 3.00  V \n",
      "The lock range of PLL FL is = 0.955  Hz \n",
      "The capture range is = 437.02  Hz \n"
     ]
    }
   ],
   "source": [
    "# determine the lock range of the FSK demodulator\n",
    "Vcc = 12 #\n",
    "Fvco = 0.25*Vcc #\n",
    "f = 200*10**3 # # Hz\n",
    "\n",
    "\n",
    "# the total time period of VCO \n",
    "t = 1/f*1e6 #\n",
    "print 'The total time period of VCO is = %0.2f'%t, ' usec '\n",
    "\n",
    "# In VCO the capacitor charging and discharging time period are equal ,so the total time period of tringular and square wave forms can be written as 2*t #\n",
    "\n",
    "\n",
    "# the charging or discharging time of capacitor \n",
    "tcap = t/2 #\n",
    "print 'The charging or discharging time of capacitor is = %0.2f'%tcap, ' usec '\n",
    "\n",
    "# the voltage swing of VCO for 12 V supply\n",
    "Fvco = 0.25*Vcc #\n",
    "print 'The voltage swing of VCO for 12 V supply is = %0.2f'%Fvco, ' V '\n",
    "\n",
    "# The lock range of PLL \n",
    "#FL = (1/2*pi*f)*(Fvco/tcap)#\n",
    "FL = (3/(2*pi*f*tcap*1e-6))#\n",
    "print 'The lock range of PLL FL is = %0.3f'%FL, ' Hz '\n",
    "\n",
    "# the capture range \n",
    "fcap = sqrt(f*FL)#\n",
    "print 'The capture range is = %0.2f'%fcap, ' Hz '"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}