#Caption:Determine Resistors Rc and Rb
#Ex14.1
Vcc=5.#Collector voltage(in volts)
Vi=5.#Input voltage(in volts)
Vf=1.2#Diode forward voltage(in volts)
hfe=100.
I=20.#Diode minimum forward current(in mA)
Vce=0.2#Collector emitter saturated voltage(in volts)
Vbe=0.7#Base emitter voltage(in volts)
Rc=(Vcc-Vf-Vce)*1000./I
Ib=I*1000./hfe
Rb=(Vi-Vbe)*1000./Ib
print '%s %.f' %('Resistors are Rc(in kilo ohm) =',Rc)
print '%s %.1f' %('Resistors are Rb(in kilo ohm) =',Rb)
#Caption:Determine meter indication when time base uses (a)6 decade counter (b)4 decade counter
#Ex14.5
f=3500.#Applied frequency(in hz)
F=10.**6.#Clock generator frequency(in hz)
f1=F/(10.**6.)
t1=1./f1
c1=f*t1
print '%s %.f' %('Cycles of input counted during t1=',c1)
f2=F/(10.**4.)
t2=1./f2
c2=f*t2
print '%s %.f' %('Cycles of input counted during t2=',c2)
#Caption:Determine required current
#Ex14.6
c=1280.#Input wave clock cycles
f=200.#Output frequency(in khz)
p=1000.#Pulses during t2
V=1.#Input voltage(in volts)
R=10.#Resistance(in kilo ohm)
C=0.1#Capacitance(in micro farad)
I=V*1000./R
T=1000./f
t1=T*c
vo=(I*t1)/(C*1000.)
t2=T*p
Ir=C*vo*1000./t2
print '%s %.f' %('Required current(in micro ampere)=',Ir)