# Chapter 15: Analog to digital converters¶

### Example 15.1 Page No 432¶

In [6]:
#Given
V1=0		#V, input unipolar voltage
V2=10		#V
Vi=5.2   	#V, applied input voltage

#calculation
LSB=V2*1000/(2**n)
Vifs=V2-LSB*10**-3
D=Vi/LSB*10**3
binary=10000101

#Result
print"(a)The minimum input voltage is",LSB,"mV"
print"(b)Input voltage  that will cause all 1s at ADC's output",Vifs,"V"
print"(c)The No of LSB's are ",round(D,0),"So The digital output code is",binary

(a)The minimum input voltage is 39 mV
(b)Input voltage  that will cause all 1s at ADC's output 9.961 V
(c)The No of LSB's are  133.0 So The digital output code is 10000101


### Example 15.2 Page No 434¶

In [8]:
#Given  (from example 15.1)
FSR=10		#V
LSB=39.1        #mA, from ex. 15.1

#Calculation
Vifs=FSR*10**3-LSB+LSB/2.0

#Result
print"The voltahe is",Vifs/1000,"V"

The voltahe is 9.98045 V


### Example 15.3 Page No 435¶

In [11]:
#Given
error=0.5      #percent
FSR=10		#V
Vifs=9.961      #From ex 15.1 (c)

#Calculation
V=FSR*error/100.0
Vin=Vifs-V*10**-3

#result
print"The required voltage is",round(Vin,2),"V"

The required voltage is 9.96 V


### Example 15.4 Page No 438¶

In [6]:
#Given
Vin1=100      #mV, input voltage
Vin2=200      #mV, input voltage

#Calculation
T2=0.833*Vin1   #From eq 15.6(b)
T2_=0.833*Vin2

#Result
print"(a)The required tome is",T2,"ms"
print"(b)The required tome is",T2_,"ms"

(a)The required tome is 83.3 ms
(b)The required tome is 166.6 ms


### Example 15.5 Page No 439¶

In [13]:
#Given
Vin=100      #mV

#Calculation
Vo=10*Vin   #From eq 15.7(c)

#Result
print"The digital output is",Vo,"counts "

The digital output is 1000 counts


### Example 15.6 Page No 442¶

In [12]:
#given
n=8   		#Bit
t=1             #micros, time for 1 clock pulse

#Calcultion
Tc=t*(n+1)

#Result
print"The required time is",Tc,"microsecond"

The required time is 9 microsecond


### Example 15.7 Page No 450¶

In [1]:
#Given
t=10   		#micros,  conversion time

#Calculation
import math
fmax=1/(2*math.pi*2**n*t*10**-6)

#Result
print"The maximum frequency is",round(fmax,0),"Hz"

The maximum frequency is 62.0 Hz


### Example 15.8 Page No 451¶

In [2]:
#Given
t=50 		#ns, aperture time
n=8
error=1         #LSB

#Calculation
import math
fmax=1/(2*math.pi*2**n*t*10**-9)

#Result
print"The maximum frequency is",round(fmax/1000,1),"Hz"

The maximum frequency is 12.4 Hz