# Chapter 9 Phase Locked Loop¶

## Example 9.1 Pg 284¶

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 '

The output voltage of switching regulator circuit is = -0.30  V
The output voltage of switching regulator circuit is = 1.50  V


## Example 9.2 Pg 285¶

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 '

The sum frequency produce by phase detector is = 900.00  KHz
The difference frequency produce by phase detector is = 100.00  KHz
The phase detector frequencies are outside of the low pass filter
The VCO will be in its free running frequency


## Example 9.3 Pg 286¶

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 '

The sensitivity of phase detector Kd is = 0.45
The maximum control voltage of VCO Vfmax = 1.40  V
The maximum frequency swing of VCO = 35.00  KHz
The maximum range of frequency which lock a PLL is = 15.00  KHz
The maximum range of frequency which lock a PLL is = 85.00  KHz
The maximum and minimum rage between 15 KHz to 85 KHZ
The lock range is = 70.00  KHz


## Example 9.4 Pg 286¶

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 '

The current through the control resistor R is = 0.60  mA
The charging time of capacitor is = 5.00  msec
The total time period of tringular and square wave is = 10.00  msec
The output frequency of VCO is = 0.10  KHz


## Example 9.5 Pg 287¶

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 '

The charging or discharging time of capacitor is = 25.00  msec
The output frequency of VCO is is = 20.00  Hz
The output frequency of VCO is = 625.00  Kohm
The current through the control resistor R is = 1.60  uA
The capacitor charging current is = 2000.00  V = 0.33Vcc


## Example 9.6 Pg 289¶

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.

The center frequency of VCO is is = 0.17  kHz
The lock range of PLL is = 2.67  KHz/V
The lock range of PLL is = 25.59 k Hz/V


## Example 9.7 Pg 290¶

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 '

The total time period of VCO is = 5.00  usec
The charging or discharging time of capacitor is = 2.50  usec
The voltage swing of VCO for 12 V supply is = 3.00  V
The lock range of PLL FL is = 0.955  Hz
The capture range is = 437.02  Hz