In [1]:

```
from __future__ import division
from math import sqrt, pi
# to find output voltage for a constant input signal frequency of 200 KHz
fo = 2*pi*1*10**3 # # KHz/V # VCO sensitivity range 4.1
fc = 500 # # Hz a free running frequency
f1 = 200 # # Hz input frequency
f2 = 2*10**3 # # Hz input frequency
# the output voltage of PLL is defined as
#Vo = (wo-wc)/ko
ko = fo #
# when i/p locked with o/p wo=wi
# Vo = (wi-wc)/ko #
#for the i/p frequency fi = 200 Hz
fi = 200 # # Hz
Vo = (((2*pi*fi)-(2*pi*fc))/ko)#
print 'The output voltage of switching regulator circuit is = %0.2f'%Vo,' V '
#for the i/p frequency fi = 200 Hz
fi = 2*10**3 # # Hz
Vo = (((2*pi*fi)-(2*pi*fc))/ko)#
print 'The output voltage of switching regulator circuit is = %0.2f'%Vo,' V '
```

In [2]:

```
from __future__ import division
# to find VCO output frequency
fc = 400 # # KHz a free running frequency
f = 10 # # KHz low pass filter bandwidth
fi = 500 # # KHz input frequency
# In PLL a phase detector produces the sum and difference frequencies are defined as
sum = fi+fc #
print 'The sum frequency produce by phase detector is = %0.2f'%sum,' KHz '
difference = fi-fc #
print 'The difference frequency produce by phase detector is = %0.2f'%difference,' KHz '
print 'The phase detector frequencies are outside of the low pass filter'#
print 'The VCO will be in its free running frequency '
```

In [3]:

```
from __future__ import division
from math import sqrt, pi
# to determine the lock range of PLL
Ko = 25 # # KHz
fo = 50 # # KHz
A = 2 #
Vd = 0.7 #
AL = 1 #
# the amximum output swing of phase detector
# Vd = Kd*(pi/2) #
# the sensitivity of phase detector Kd is
Kd = Vd*(2/pi) #
print 'The sensitivity of phase detector Kd is = %0.2f'%Kd,''
# The maximum control voltage of VCO Vfmax
Vfmax = (pi/2)*Kd*A #
print 'The maximum control voltage of VCO Vfmax = %0.2f'%Vfmax,' V'
# the maximum frequency swing of VCO
fL = (Ko*Vfmax)#
print 'The maximum frequency swing of VCO = %0.2f'%fL,' KHz'
# The maximum range of frequency which lock a PLL are
fi = fo-fL #
print 'The maximum range of frequency which lock a PLL is = %0.2f'%fi,' KHz '
fi = fo+fL #
print 'The maximum range of frequency which lock a PLL is = %0.2f'%fi,' KHz '
print 'The maximum and minimum rage between 15 KHz to 85 KHZ '
# the lock range is
fLock = 2*fL #
print 'The lock range is = %0.2f'%fLock,' KHz '
```

In [4]:

```
from __future__ import division
# to determine the output frequency capacitor charging time of VCO
Vcc = 12 #
Vcs = 6
R = 10 # # K ohm
C = 1 # # uF
# the current through the control resistor R
i =(Vcc-Vcs)/R #
print 'The current through the control resistor R is = %0.2f'%i, ' mA '
# The charging time of capacitor
t = (0.25*Vcc*C)/i #
print 'The charging time of capacitor is = %0.2f'%t, ' msec '
# 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 #
t = ((0.5*Vcc*C)/i)#
print 'The total time period of tringular and square wave is = %0.2f'%t, ' msec '
# the output frequency of VCO is
fo = 1/t #
print 'The output frequency of VCO is = %0.2f'%fo, ' KHz '
```

In [5]:

```
from __future__ import division
from math import sqrt, pi
# to design VCO with output square wave pulse time of 50 msec
Vcc =6 #
Vcs = 5 #
R = 22 # #K ohm
C = 0.02 # # uF
t = 50*10**-3 # # sec output square wave pluse
# 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 #
# the charging or discharging time of capacitor
tcap = t/2*1e3 #
print 'The charging or discharging time of capacitor is = %0.2f'%tcap, ' msec '
# the output frequency of VCO is
fo = 1/t #
print 'The output frequency of VCO is is = %0.2f'%fo, ' Hz '
# the output frequency of VCO
# fo = (1/4*R*C)#
R = 1/(4*fo*1e3*C*1e-9)/1e3 # Kohm
print 'The output frequency of VCO is = %0.2f'%R, ' Kohm'
# the current through the control resistor R
i =(Vcc-Vcs)/R*1e3 #
print 'The current through the control resistor R is = %0.2f'%i, ' uA '
# the capacitor charging current
# (V/t)=(i/C) #
V = (i/C)*tcap #
print 'The capacitor charging current is = %0.2f'%V, ' V = 0.33Vcc '
```

In [6]:

```
from __future__ import division
from math import sqrt, pi
# to determine the center frequency of VCO lock and capture range of PLL
R = 15 # # K ohm
C = 0.12 # # uF
Vcc = 12 #
# the center frequency of VCO fo
fo = (1.2/4/(R*1e3)/(C*1e-6))/1e3#
print 'The center frequency of VCO is is = %0.2f'%fo, ' kHz '
fo = 4 # # KHz
# the lock range of PLL
fL = (8*fo/Vcc) #
print 'The lock range of PLL is = %0.2f'%fL, ' KHz/V '
# the capture range of PLL
fc = ((fo-fL)/(2*pi*3.6*10**3*C*1e-6)**(1/2)) #
print 'The lock range of PLL is = %0.2f'%fc, 'k Hz/V '
# ans wrong in the textbook.
```

In [7]:

```
from __future__ import division
from math import sqrt, pi
# determine the lock range of the FSK demodulator
Vcc = 12 #
Fvco = 0.25*Vcc #
f = 200*10**3 # # Hz
# the total time period of VCO
t = 1/f*1e6 #
print 'The total time period of VCO is = %0.2f'%t, ' usec '
# 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 #
# the charging or discharging time of capacitor
tcap = t/2 #
print 'The charging or discharging time of capacitor is = %0.2f'%tcap, ' usec '
# the voltage swing of VCO for 12 V supply
Fvco = 0.25*Vcc #
print 'The voltage swing of VCO for 12 V supply is = %0.2f'%Fvco, ' V '
# The lock range of PLL
#FL = (1/2*pi*f)*(Fvco/tcap)#
FL = (3/(2*pi*f*tcap*1e-6))#
print 'The lock range of PLL FL is = %0.3f'%FL, ' Hz '
# the capture range
fcap = sqrt(f*FL)#
print 'The capture range is = %0.2f'%fcap, ' Hz '
```