from __future__ import division
n=3
print "n= %0.2f"%(n) # Number of bits
L=2**(n)
print "L=2**(n)= %0.2f"%(L)# Number of quantization levels
VFS=10
print "VFS= %0.2f"%(VFS)," volts" # Maximum value of analog input voltage
QE=VFS/L
print "Q.E=VFS/L= %0.2f"%(QE)# Quantization error
print "Q.E= +0.625,-0.625"# To make Quantization error symmetrical ittaken as (-Q.E/2) negative and positive value(+Q.E/2)
Resolution=(100/2**(n))#Formulae
print "Resolution=(100/2**(n))= %0.2f"%(Resolution)," percent"#Resolution
print "Resolution= %0.2f"%(+Resolution)," percent,%0.2f"%(-Resolution)," percent"# Since Resolution is (+)as well as (-)
from __future__ import division
n=3
print "n= %0.2f"%(n) # Number of bits
L=2**(n)
print "L=2**(n)= %0.2f"%(L) # Number of quantization levels
VFS=1024*10**(-3)
print "VFS= %0.2f"%(VFS)," volts" # Maximum value of analog input voltage
print "part(i)"# Part(i)
LSB=VFS/(2**n)
print "LSB=VFS/(2**n)= %0.2f"%(LSB)," volts" # Lowest significant bit of 3-bit ADC
print "part(ii)"# Part(ii)
print "vh= 64 to 192 mV with offset" # Analog voltage corresponding to binary word 001
print "part(iii)"# Part(iii)
IE=(LSB)/2
print "Inherent error,I.E= (LSB)/2= -%0.2f"%(IE)," V,+%0.2f"%(IE)," V"# Inherent error in each binary word
print "part(iv)"# Part(iv)
Resolution=(1*10**(-3))
print "Resolution= %0.2f"%(Resolution)," V"#Resolution
VFS=1
print "VFS= %0.2f"%(VFS)," V" # Maximum value of analog input voltage2
k=VFS/(Resolution)
print "k=VFS/(Resolution)= %0.2e"%(k) # 'k' taken only for calculation purpose
print "number of bits=10"# since k =[VFS/(Resolution)]is approximately equal to 2**10,
print "so 10-bit ADC required"
from __future__ import division
VREF=-10
print "VREF= %0.2f"%(VREF)," V" # Reference voltage
RF=5*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" #Feedback resistance
R=10*10**(3)
print "R= %0.2f"%(R)+ " ohm" # resistance
vLSB=(-RF*VREF)/(8*R)# Since IF=I/8,so vLSB=(-RF*IF)=(-RF*I/8)=(-RF*VREF/8*R)
print "vLSB=(-RF*VREF)/(8*R)=%0.2f"%(vLSB)," V" # Equivalent voltage for binary word 0001
vo=-2*vLSB# Since current IF=I/4
print "vo = -2*vLSB =%0.2f"%(vo)," V" # Equivalent voltage for binary word 0010=2 (in decimal)
vo=-15*vLSB# Since current IF=I+(I/2)+(I/4)+(I/8)=(15*I/8),so vo=15*VLSB
print "vo= -15*vLSB =%0.2f"%(vo)," V" # Equivalent voltage for binary word 0010=2 (in decimal)
from __future__ import division
VREF=-10
print "VREF= %0.2f"%(VREF)," V" # Reference voltage
RF=5*10**(3)
print "RF= %0.2f"%(RF)+ " ohm" #Feedback resistance
R=10*10**(3)
print "R= %0.2f"%(R)+ " ohm" # resistance
vMSB=-(RF*VREF)/(2*R)# Since IF=I/2,so vMSB=(-RF*IF)=(-RF*I/2)=(-RF*VREF/2*R)
print "vMSB=-(RF*VREF)/(2*R)=%0.2f"%(vMSB)," V" # Equivalent voltage for binary word 1000=8(in decimal)
vo2=vMSB/2# Since current IF=I/4
print "vo2 = vMSB/2 =%0.2f"%(vo2)," V" # Equivalent voltage for binary word 0100=4 (in decimal)
vo3=(15/8)*vMSB# Since current IF=I+(I/2)+(I/4)+(I/8)+(I/16)=(15*I/6),so vo=(15/8)*VMSB
print "vo3= (15/8)*vMSB =%0.2f"%(vo3)," V" # Equivalent voltage for binary word 1111=15 (in decimal)
from __future__ import division
n=12
print "n= %0.2f"%(n) # Number of bits
VFS=50
print "VFS= %0.2f"%(VFS)," volts" # Maximum value of analog input voltage
S=VFS/(2**n)
print "S=VFS/(2**n)= %0.2f"%(S)," volts" # Maximum quantization error
Resolution=(100/2**(n))#Formulae
print "Resolution=(100/2**(n))= -%0.2f"%(Resolution)," percent, +%0.2f"%(Resolution)," percent"# Since Resolution is (+)as well as (-)
from math import pi
from __future__ import division
n=12
print "n= %0.2f"%(n) # Number of bits
t=5*10**(-6)
print "t= %0.2e"%(t)," A"
Vsp=10
print "Vsp= %0.2f"%(Vsp)," volts" # value of analog input voltage
LSB=Vsp/(2**n)
print "LSB=Vsp/(2**n)= %0.4f"%(LSB)," volts" # Lowest significant bit of 12-bit ADC
print "LSB/2= -%0.4f"%(LSB/2)," V, -%0.2f"%(LSB/2)," V"
SR=(LSB/2)/t
print "SR=(LSB/2)/t= %0.2f"%(SR)," V/s"
fmax=SR/(2*pi*Vsp)
print "f = SR/(2*pi*Vsp)=%0.2f"%(fmax)," Hz"# Highest frequency allowed at the input