Chapter 12 Analog To Digital Converter(A/D Converter)

Example 12.2 Pg 350

In [1]:
from __future__ import division
# Determine the following parameter of 8-bit A/D converter a) Normalized step size b) Actual step size  c) Normalized maximum quantization level  d) Actual maximum quantization  e) Normalized peak quantization error  f) Actual peak quantization error  g) Percentage of quantization error
N = 8 #
Vin = 12 #

#a) Normalized step size of A/D converter
Ns = 2**-N #
print 'Normalized step size of A/D converter is = %0.8f'%Ns

# b) Actual step size of A/D converter
As = Vin*Ns #
print 'Actual step size of A/D converter is = %0.6f'%As

# c) Normalized maximum quantization level of A/D converter
Qmax = 1-2**-N #
print 'Normalized maximum quantization level of A/D converter is = %0.4f'%Qmax

# d) Actual maximum quantization level of A/D converter
QAmax = Qmax*Vin #
print 'Actual maximum quantization level of A/D converter is = %0.4f'%QAmax

# e) Normalized peak quantization error of A/D converter
Qp = 2**-(N+1)#
print 'Normalized peak quantization error of A/D converter is = %0.6f'%Qp

# f) Actual peak quantization error of A/D converter
Qe = Qp*Vin #
print 'Actual peak quantization error of A/D converter is = %0.6f'%Qe,' V '#

# g) Percentage of quantization error of A/D converter
per_Qp = 2**-(N+1)*100 #
print 'Percentage of quantization error of A/D converter is = %0.4f'%per_Qp
Normalized step size of A/D converter is = 0.00390625
Actual step size of A/D converter is = 0.046875
Normalized maximum quantization level of A/D converter is = 0.9961
Actual maximum quantization level of A/D converter is = 11.9531
Normalized peak quantization error of A/D converter is = 0.001953
Actual peak quantization error of A/D converter is = 0.023438  V 
Percentage of quantization error of A/D converter is = 0.1953

Example 12.3 Pg 351

In [2]:
from __future__ import division
# to determine the binary output of the 8-bit dual slope A/D converter
Vin = 8.5 #
VR = 10 #
f = 2 #  #MHz
N = 8 #
C = 0.1*10**-6 #
R = 2*10**3 #

# the output of integrator is defined as 
# Viao(T1) = -(Vin/R*C)*T1 #

# charging time of capacitor 
T1 = 2**N/f #
print 'charging time of capacitor  is = %0.2f'%T1,' u sec'

# the integrator output
T1 = T1*10**-6 #
Viao =-(Vin/(R*C))*T1#
print 'the integrator output is = %0.2f'%Viao,' V'

# the binary output of a dual slope A/D converter
Bn = (2**N*Vin)/VR#
print 'the decimal output of a dual slope A/D converter is = %0.2f'%Bn,'   = 218'#

Bn=218#
Bn = bin(Bn) #
print 'The binary output of a dual slope A/D converter is =',Bn[2:]
charging time of capacitor  is = 128.00  u sec
the integrator output is = -5.44  V
the decimal output of a dual slope A/D converter is = 217.60    = 218
The binary output of a dual slope A/D converter is = 11011010

Example 12.4 Pg 352

In [3]:
from __future__ import division
# to determine the resolution of 12-bit A/D converter
N =12 #
Vin = 15 #

# Resolution of an A/D converter
Resolution = Vin/(2**N-1)#
print 'Resolution of an A/D converter is = %0.4f'%Resolution,' V '
#
Resolution of an A/D converter is = 0.0037  V 

Example 12.5 Pg 352

In [4]:
from __future__ import division
# to determine the output time and duty cycle of V/T converter
Vin = 5 #
C = 0.1*10**-6 # 
R = 10*10**3 #
C1 = 100*10**-6 #

# The output time of a V/T converter is given as
T = (7.5*C1)/(Vin) #
print 'The output time of a V/T converter is =',T*1000,' msec'

TH = 0.075 #
TL=TH # # we consider
# The duty cycle of V?T converter
D = (TL+TH)/(TH) #
print 'The duty cycle of V?T converter is = %0.2f'%D

# The output voltage of an integrator is define as
Vio = -(Vin)/(R*C)*T #
print 'The output voltage of an integrator is is = %0.2f'%Vio,' V'
The output time of a V/T converter is = 0.15  msec
The duty cycle of V?T converter is = 2.00
The output voltage of an integrator is is = -0.75  V