Chapter 17 Data acquisition system

Example 17.1 Page no 640

In [23]:
#Given
n=5                     #bit
a=10
b=20
c=30

#Calculation
Wlsb=-(1/2.0**n-1)
Wlsb2=(2/2.0**n)
Wlsb3=(4/2.0**n)
V1=a/(2.0**n-1)
V2=b/(2.0**n-1)
V3=c/(2.0**n-1)
Va=(a*2**4+a*2**3+0*2**2+a*2**1+a*2**0)/(2.0**5-1)
Vb=(a*2**4+0*2**3+a*2**2+a*2**1+0*2**0)/(2.0**5-1)
#Result
print"(1) The LSB Weight is ", round(Wlsb,2)
print"(2) The 2nd LSB Weight is ", round(Wlsb2,2),"And 2rd LSB weight is ",Wlsb3
print"(3) Ist LSB causes a change in output voltage is ", round(V1,1)
print"    2nd LSB causes a change in output voltage is ", round(V2,1)
print"    3rdLSB causes a change in output voltage is ", round(V1,1)
print"(4) Output voltage for 11011 is " ,round(Va,2),"Volt"
print"    Output voltage for 10110 is " ,round(Vb,2),"Volt"
(1) The LSB Weight is  0.97
(2) The 2nd LSB Weight is  0.06 And 2rd LSB weight is  0.125
(3) Ist LSB causes a change in output voltage is  0.3
    2nd LSB causes a change in output voltage is  0.6
    3rdLSB causes a change in output voltage is  0.3
(4) Output voltage for 11011 is  8.71 Volt
    Output voltage for 10110 is  7.1 Volt