In [8]:

```
from __future__ import division
#Given data
Vi = 5.1 #input voltage in V
n = 8 # number of bit
Resolution = 2**n
Resolution = Vi/(Resolution-1) # in V/LSB
Resolution= Resolution*10**3 # in mV/LSB
print "The Resolution = %0.f mV/LSB " %Resolution
Resolution= Resolution*10**-3 # in V/LSB
Vi = 1.28 # in V
D = Vi/Resolution #digital output in LSBs
DigitalOutput= bin(int(D)) # digital output in binary
print "The binary equivalent digital output = " ,DigitalOutput
```

In [4]:

```
#Given data
n = 12 #number of bit
Vi = 4.095 #input voltage in V
Q_E = Vi/(((2**n)-1)*2) #quantizing error in V
Q_E = Q_E * 10**3 # in mV
print "The quantizing error = %0.1f mV " %Q_E
```

In [5]:

```
#Given data
# When Vi=100 mV
Vi = 100 # in mV
V_R = 100 # in mV
t1 = 83.33 # in ms
t2 = (Vi/V_R)*t1 # in ms
print "When Vi=100 mV, the value of t2 = %0.2f ms " %t2
# When Vi=200 mV
Vi = 200 # in mV
t2 = (Vi/V_R)*t1 # in ms
print "When Vi=200 mV, the value of t2 = %0.1f ms " %t2
```

In [6]:

```
#Given data
t1 = 83.33 # in ms
V_R = 100 # in mV
Vi = 100 # in mV
fc = 12 #clock frequency in kHz
fc = fc* 10**3 # in Hz
Digitaloutput = round(fc*t1*(Vi/V_R)*10**-3) #digital output in counts
print "The Digital output = %0.f counts " %Digitaloutput
```

In [7]:

```
#Given data
f = 1 # in MHz
f = f * 10**6 # in Hz
T = 1/f # in sec
T = T * 10**6 # in µsec
n = 8
# Conversion time
T_C = T*(n+1) # in µsec
print "The conversion time = %0.f µsec " %T_C
```

In [9]:

```
from numpy import pi
#Given data
n = 8 # number of bit
T_C = 9 #conversion time in µs
T_C = T_C * 10**-6 # in s
# The maximum frequency
f_max = 1/(2*pi*T_C*(2**n)) # in Hz
print "The maximum frequency = %0.2f Hz " %f_max
```

In [10]:

```
#Given data
n = 3 # number of bit
R = 1/(10**n)
V = 1 # in V
# For 1V range,
Resolution = V*R # in V
print "For 1 V range, the resolution = %0.3f V " %Resolution
# For 50 V range,
V = 50 # in V
Resolution = V*R # in V
print "For 50 V range, the resolution = %0.2f V " %Resolution
```

In [14]:

```
#Given data
n = 4 # number of bit
R = 1/(10**n)
print "Part (i) : The resolution = %0.4f " %R
# There are 5 digit places in 4 1/2 digits, so
print "Part (ii) : 11.87 would be displayed as 11.870"
Reading= 0.5573
print "Part (iii) : On 1 V range, 0.5573 will be displayed as = %0.3f " %Reading
print "On 10 V range, 0.5573 will be displayed as = %0.4f " %Reading
```