#Ex 7.1
RA=6.8 #kohm
RB=3.3 #kohm
C=0.1 #micro F
VCC=5 #V
t_high=0.695*(RA+RB)*C #ms
print round(t_high,1)," =(a) t_high(ms) "
t_low=0.695*RB*C #ms
print round(t_low,2)," =(b) t_low(ms) "
f=1.44/(RA+2*RB)/(C) #kHz
print round(f,2)," =(c) Frequency of oscillation(kHz) "
#Ex 7.2
RA=10 #kohm
C=0.1 #micro F
t=1.1*RA*C #ms
print t,"= Timing interval(ms) "
#Ex 7.3
fc=500 #kHz(Free running frequuency)
fi=600 #kHz(Input signal frequuency)
BW=10 #kHz
out1=fi+fc #kHz(Phase detector output)
out2=fi-fc #kHz(Phase detector output)
print out2,out1,"= Output of phase detector will be(kHz) "
print "Both components are not lying in the passband(i.e. 10 kHz). Hence loop will not acquire lock. "
#fi+fc is calculated wrong in the book.
#Ex 7.4
import math
fo=10.0 #kHz
V=12.0 #V
fL=round(8*fo/(V-(-V)),2) #kHz(both +ve & -ve value)
C=10 #micro F(Assumed)
fC=round(math.sqrt(fL*10**3/(2*math.pi*3.6*10**3*C*10**-6)),2) #Fz(both +ve & -ve value)
print fC,fL,"= Frequency fL & fC in kHz "
LR=2*fL #kHz(Lock Range)
print round(LR,1),"= Lock Range(kHz) "
CR=2*fC #kHz(Capture rage)
print round(CR,1),"= Capture Range(Hz) "
#Ex 7.5
import math
fo=100.0 #kHz(Free running frequency)
V=6.0 #V(both +ve & -ve value)
C=1 #micro F(Demodulation capacitor)
fL=round(8*fo/(V-(-V)),3) #Hz(both +ve & -ve value)
fC=math.sqrt(fL*1000/(2*math.pi*3.6*10**3*C*10**-6)) #kHzz(both +ve & -ve value)
LR=round(2*fL,2) #kHz(Lock range)
print LR,"= Lock Range(kHz)"
CR=round(2*fC/1000,2) #kHz(Capture range)
print CR,"= Capture Range(kHz) "
RT=10 #kohm(Assumed)
CT=1.2/(4*RT*1000*fo*10**3) #F
print "Design values are:"
print "Resistance RT can be chooosen as 10 kohm. "
print CT," =Capacitance CT(F) "
#Ex 7.7
import math
C=1 #nF
T=10 #micro seconds(Output pulse duration)
R=round(T*10**-6/(C*10**-9*math.log(3))/1000,1) #kohm
print R," =(a) Value of R(kohm) "
VCC=15 #V
T=20 #micro seconds(Output pulse duration)
VTH=VCC*(1-exp(-T*10**-6/(R*1000*C*10**-9))) #V
print round(VTH,1)," =(b) Value of VTH(V) "
#Ex 7.8
import math
C=680.0 #pF
f=50.0 #kHz(Square wave frequency)
D=75.0/100.0 #duty cycle
T=1/f*1000 #micro seconds
tHIGH=D*T #micro seconds
print tHIGH," = Value of tHIGH "
tLOW=T-tHIGH #micro seconds
print tLOW," = Value of tLOW "
RB=(tLOW*10**-6)/(0.69*C*10**-12) #ohm
RA=(tHIGH*10**-6)/(0.695*C*10**-12)-RB #ohm
print round(RA/1000,1)," = Value of RA(kohm) "
print round(RB/1000,2)," = Value of RB(kohm) "
# Answer in the book is wrong for RA i.e. 21.2