# Chapter 16 : Integrated Circuits as Analog System Building blocks¶

## Example 16.1, Page No 621¶

In [1]:
import math
#initialisation of variables

#Caption:Fourth Order Butterworth Filter
#Given Data
fo=1.0		#Cutoff Frequency in Hz
#For n = 4
k1=0.765
k2=1.848
Av1 = 3-k1
Av2 = 3-k2

#Calculations
print('For a fourth order Buttworth filter we cacade 2 second order Buttworth filter with parameters R1 R2 R1d R2d R C')
#we arbitrarily choose
R1=10.0  	#in K
print("The value of R1= %.2f K " %R1)
#Av1=(R1+R1d)/R1
R1d=(Av1*R1)-R1
print("The value of R1d= %.2f K " %R1d)

R2 = 10.0      #in K
print("The value of R2= %.2f K " %R2)
R2d=(Av2*R2)-R2
print("The value of R2d= %.2f K " %R2d)

#Results
#To satisfy fo = 1/(2*math.pi*r*c) = 1kHz
R=1#in K
C = 1/(2*math.pi*R*fo)
print("The value of R = %.2f K " %R)
print("The value of C = %.2f microF " %C)

For a fourth order Buttworth filter we cacade 2 second order Buttworth filter with parameters R1 R2 R1d R2d R C
The value of R1= 10.00 K
The value of R1d= 12.35 K
The value of R2= 10.00 K
The value of R2d= 1.52 K
The value of R = 1.00 K
The value of C = 0.16 microF


## Example 16.2, Page No 626¶

In [2]:
import math

#initialisation of variables
Ao=50.0    #Gain
fo=160.0   #center frequency
B=16.0     #Bandwidth in Hz
C1=0.1     #in microF
C2=0.1     #in microF

#Required Formulae

#Calculations
Q=fo/B
R1=(1000*Q)/(Ao*2*math.pi*fo*C1)
R3=(1000*Q)/((2*math.pi*fo)*(C1*C2/(C1+C2)))
#As C is in microFarad to compensate for it 1000 is multiplied
#Let r = R'
r=(10**6)/((2*math.pi*fo)**2*R3*C1*C2)
R2=(R1*r)/(R1-r)

#Results
print("The value of R1= %.2f K " %R1)
print("The value of R3= %.2f K " %R3)
print("The value of r= %.2f ohm " %(r*10**3))
print("The value of R2= %.2f ohm " %(R2*10**3))

The value of R1= 1.99 K
The value of R3= 198.94 K
The value of r= 497.36 ohm
The value of R2= 663.15 ohm


## Example 16.3 Page No 638¶

In [3]:
import math

#initialisation of variables

Avo=-25.0
Vagc=20.0   #in V
Vcc=6.0   #in V
hfe=50.0
rbb=50.0  #in ohm
Cs=5.0     #in pF
Cl=5.0    #in pF
Ie1=1.0  #in mA
ft=900.0 #in MHz
Vt=26.0 #in V
n=2.0  #eeta
#re2 = infinity

#Calculations
#Since Vagc=0 , transistor Q2 is in cut off region and collector current of Q1 flows through Q3....So
Ie2=0
Ie3=1.0    #in mA
re3 = (n*Vt)/Ie3   #in ohm
print("The value of re3 = %.2f ohm " %re3)
gm = (Ie1)/Vt     #in ohm^-1
print("The value of gm = %.2f ohm^-1 " %gm)
rbe=hfe/gm
print("The value of rbe = %.2f ohm " %rbe)
Ce=gm/(2*math.pi*ft*10**-6)
print("The value of Ce = %.2f pF " %Ce)
a3=1.0  #we make an assumption that alpha is one
s=0
#Av0 = -((a3*gm)/(re3*rbb))*(1/(((1/rbb)+(1/rbe)+(s*Ce))*((1/re3)+(s*Cs))*((1/Rl)+(s*(Cs+Cl)))))
#From here we can find Rl
k = -((a3*gm)/(re3*rbb))*(1/(((1/rbb)+(1/rbe)+(s*Ce))*((1/re3)+(s*Cs))))
Rl=Avo/k
print("The value of Rl = %.2f ohm " %Rl)
#C is in picoFarad so to compensate the whole equation some constants are multiplied
f1 = 1.0/(2*math.pi*Rl*(Cs+Cl)*10**-6)

#Results
print("The value of f1 = %.2f MHz " %f1)
f2 = 1.0/(2*math.pi*Ce*10**-6*((rbe*rbb)/(rbe+rbb)))
print("The value of f2 = %.2f MHz " %f2)
f3 = 1.0/(2*math.pi*Cs*re3*10**-6)
print("The value of f3 = %.2f MHz " %f3)

The value of re3 = 52.00 ohm
The value of gm = 0.04 ohm^-1
The value of rbe = 1300.00 ohm
The value of Ce = 6.80 pF
The value of Rl = 675.00 ohm
The value of f1 = 23.58 MHz
The value of f2 = 486.00 MHz
The value of f3 = 612.13 MHz


## Example 16.4a, Page No 656¶

In [4]:
import math
#initialisation of variables

Vbb = 1.15    #in V
Vee=5.20       #in V
Vbe5=0.7      #in V
R=1.18        #in K
r=300.0       #in ohm
Vbecutin=0.5    #in V

#Calculations
#If all inputs are low then we assume that Q1,Q2 and Q3 are cutoff and Q4 is conducting
Ve=-Vbb-Vbe5#Voltage at Common Emitter in V
#Current I in 1.18K Resistor
I = (Ve+Vee)/R#in mA
I1=I
print("Current in 300 ohm resistance I= %.2f mA " %I)
#Output Voltage at Y
vy = -(r*I/1000)-Vbe5       #I is in mA so 1000 is multiplied
Vbe = vy-Ve
print("The value of Vbe is %.2f v " %Vbe)
if Vbe<Vbecutin :
print('Input transistors are non conducting as was assumed')
print('If atleast one input is high then it is assumed that curent in 1.18K resistance is switched to R and Q4 is cutoff')
print('Drop in 300 ohm resistance is zero.Since the base aand collector are tied together Q5 now behaves as a diode')
print('Across Q5')
v=0.7#voltage across Q5 in V
rQ5 = 1.5#in K
i = (Vee-v)/rQ5
v = 0.75#from the graph in V
print("The value of i is %.2f mA " %i)
print("The value of V is %.2f v " %v)
Ve = -v-Vbe5
Vbe4=-Vbb-Ve
print("The value of Vbe4 is %.2f v " %Vbe4)

#Results
print('The total output swing between two logic gates')
vo = -vy-v
print("The value of vo is %.2f v " %vo)

Current in 300 ohm resistance I= 2.84 mA
The value of Vbe is 0.30 v
Input transistors are non conducting as was assumed
If atleast one input is high then it is assumed that curent in 1.18K resistance is switched to R and Q4 is cutoff
Drop in 300 ohm resistance is zero.Since the base aand collector are tied together Q5 now behaves as a diode
Across Q5
The value of i is 3.00 mA
The value of V is 0.75 v
The value of Vbe4 is 0.30 v
The total output swing between two logic gates
The value of vo is 0.80 v


## Example 16.4b Page No 656¶

In [5]:
import math
#initialisation of variables
Vbb = 1.15    #in V
Vee=5.20      #in V
Vbe5=0.7     #in V
R=1.18       #in K
r=300        #in ohm
Vbecutin=0.5    #in V

#Calculations
#If all inputs are low then we assume that Q1,Q2 and Q3 are cutoff and Q4 is conducting
Ve=-Vbb-Vbe5          #Voltage at Common Emitter in V
#Current I in 1.18K Resistor
I = (Ve+Vee)/R#in mA
I1=I
#Output Voltage at Y
vy = -(r*I/1000)-Vbe5     #I is in mA so 1000 is multiplied
Vbe = vy-Ve
if Vbe<Vbecutin :
v=0.7                #voltage across Q5 in V
rQ5 = 1.5#in K
i = (Vee-v)/rQ5
v = 0.75           #from the graph in V
Ve = -v-Vbe5
Vbe4=-Vbb-Ve

vo = -vy-v

#Results
#Calculation of noise margin
vn = Vbecutin-Vbe4
print('Positive noise spike which will cause the gate to malfunction')
print("The value of vn is %.2f v " %vn)

Positive noise spike which will cause the gate to malfunction
The value of vn is 0.20 v


## Example 16.4c Page No 656¶

In [6]:
import math

#initialisation of variables

#Verify that conducting transistor is in active region
#Given Data
Vbb = 1.15   #in V
Vee=5.20       #in V
Vbe5=0.7      #in V
R=1.18       #in K
r=300.0     #in ohm
Vbecutin=0.5  #in V

#Calculations
#If all inputs are low then we assume that Q1,Q2 and Q3 are cutoff and Q4 is conducting
Ve=-Vbb-Vbe5#Voltage at Common Emitter in V
#Current I in 1.18K Resistor
I = (Ve+Vee)/R     #in mA
I1=I
#Output Voltage at Y
vy = -(r*I/1000)-Vbe5       #I is in mA so 1000 is multiplied
Vbe = vy-Ve
if Vbe<Vbecutin :
v=0.7    #voltage across Q5 in V
rQ5 = 1.5   #in K
i = (Vee-v)/rQ5
v = 0.75    #from the graph in V
Ve = -v-Vbe5
Vbe4=-Vbb-Ve

vo = -vy-v

Vb4 = Vbb
Vc4 = -(I*r)/1000     #in V
Vcb4 = Vc4+Vb4
print("The value of Vcb4 is %.2f v " %Vcb4)
if Vcb4>0 :
print('For on npn transistor this represents a reverse bias and Q4 must be in active region')

Vb1 = v
Vc1 = vy+Vbe5
Vcb1 = Vc1 + Vb1

#Results
print("The value of Vc1 is %.2f v " %Vc1)
print("The value of Vcb1 is %.2f v " %Vcb1)
if Vcb1<0 :
print('For an npn transistor this represents a forward bias.... therefore Q1 is in saturation region')

The value of Vcb4 is 0.30 v
For on npn transistor this represents a reverse bias and Q4 must be in active region
The value of Vc1 is -0.85 v
The value of Vcb1 is -0.10 v
For an npn transistor this represents a forward bias.... therefore Q1 is in saturation region


## Example 16.4d, Page No 656¶

In [7]:
import math
#initialisation of variables
Vbb = 1.15       #in V
Vee=5.20         #in V
Vbe5=0.7         #in V
R=1.18           #in K
r=300.0          #in ohm
Vbecutin=0.5    #in V

#Calculations

#If all inputs are low then we assume that Q1,Q2 and Q3 are cutoff and Q4 is conducting
Ve=-Vbb-Vbe5#Voltage at Common Emitter in V
#Current I in 1.18K Resistor
I = (Ve+Vee)/R#in mA
I1=I
#Output Voltage at Y
vy = -(r*I/1000.0)-Vbe5#I is in mA so 1000 is multiplied
Vbe = vy-Ve
if Vbe<Vbecutin :
v=0.7#voltage across Q5 in V
rQ5 = 1.5#in K
i = (Vee-v)/rQ5
v = 0.75#from the graph in V
Ve = -v-Vbe5
Vbe4=-Vbb-Ve

vo = -vy-v

#Verify that conducting transistor is in active region
Vb4 = Vbb
Vc4 = -(I*r)/1000#in V
Vcb4 = Vc4+Vb4
Vb1 = v
Vc1 = vy+Vbe5
Vcb1 = Vc1 + Vb1

Vbe1 = Vbe5
Ve = -(Vb1+Vbe1)

#Results

print("The value of Ve is %.2f v " %Ve)
I = (Ve + Vee)/R
I2=I
R = -Vc1/I
print("The value of R is %.2f ohm " %R)

The value of Ve is -1.45 v
The value of R is 0.27 ohm


## Example 16.4e Page No 656¶

In [8]:
import math

#initialisation of variables

Vbb = 1.15#in V
Vee=5.20#in V
Vbe5=0.7#in V
R=1.18#in K
r=300.0 #in ohm
Vbecutin=0.5#in V

#Calculations
#If all inputs are low then we assume that Q1,Q2 and Q3 are cutoff and Q4 is conducting
Ve=-Vbb-Vbe5#Voltage at Common Emitter in V
#Current I in 1.18K Resistor
I = (Ve+Vee)/R#in mA
I1=I
#Output Voltage at Y
vy = -(r*I/1000.0)-Vbe5#I is in mA so 1000 is multiplied
Vbe = vy-Ve
if Vbe<Vbecutin :
v=0.7#voltage across Q5 in V
rQ5 = 1.5#in K
i = (Vee-v)/rQ5
v = 0.75#from the graph in V
Ve = -v-Vbe5
Vbe4=-Vbb-Ve

vo = -vy-v

Vb4 = Vbb
Vc4 = -(I*r)/1000.0#in V
Vcb4 = Vc4+Vb4
Vb1 = v
Vc1 = vy+Vbe5
Vcb1 = Vc1 + Vb1

Vbe1 = Vbe5
Ve = -(Vb1+Vbe1)
I = (Ve + Vee)/R
I2=I

I =(I1+I2)/2.0

#Results
print("The value of I is %.2f mA " %I)
I2 = (Vee-v)/rQ5
I3 = (Vee+vy)/rQ5
I = I + I2 + I3
P = Vee*I
print("Power dissipated  is %.2f mW " %P)

The value of I is 3.01 mA
Power dissipated  is 43.72 mW


## Example 16.5 Page No 668¶

In [9]:
import math
#initialisation of variables
C=50.0    #nF
Ra=10.0    #kOhm
Vcc=5.0     #V
beta=20.0

#Calculations
T=1.1*Ra*C
Ib=(Vcc-0.7)/100
Ic=beta*Ib
dt=C*(Vcc/Ic)

#Results
print("Another pulse can be generated at hte output after time period of = %.2f ns " %dt)

Another pulse can be generated at hte output after time period of = 290.70 ns