from __future__ import division
#Given data
V_REF= 10 # in volt
w2= V_REF/2 # The second MSB weight in volt
print "The second MSB weight = %0.f V" %w2
w3= V_REF/4 # The third MSB weight in volt
print "The third MSB weight = %0.1f V" %w3
w4= V_REF/8 # The forth MSB weight in volt
print "The forth MSB weight = %0.2f V" %w4
# (i)
r_DAC= w4 # resolution of the DAC in volt
print "(i) : Resolutio of the DAC = %0.2f V" %r_DAC
#(ii)
FSO= V_REF+w2+w3+w4 #full scale output in volt
print "(ii) : Full scale output = %0.2f V" %FSO
# (iii)
FSO_R= FSO/4 # full scale output when the feedback resistor is made one fourth of R in volt
print "(iii) : The full scale output when the feedback resistor is made one fourth of R i volt = %0.4f" %FSO_R
#Given data
V_REF= -5 # in volt
V_A= -5 # in volt
V_C=V_A # in volt
V_D=V_C # in volt
V_B= 0
Vout= -1*(V_A+V_B/2+V_C/4+V_D/8)
print "Output voltage = %0.3f V" %Vout
#Given data
D=16
D1= D/2 # first MSB output in volt
print "First MSB output = %0.f V" %D1
D2= D/4 # second MSB output in volt
print "Second MSB output = %0.f V" %D2
D3= D/8 # third MSB output in volt
print "Third MSB output = %0.f V" %D3
D4= D/16 # fourth MSB output in volt
print "Fourth MSB output = %0.f V" %D4
D5= D/32 # fifth MSB output in volt
print "Fifth MSB output = %0.1f V" %D5
D6= D/64 # sixth MSB (LSB) output in volt
print "Sixth MSB (LSB) output = %0.2f V" %D6
print "The resolution is equal to the weight of the LSB = %0.2f V" %D6
# Full scale output occurs for a digital input of 111111
FSO= D1+D2+D3+D4+D5+D6 # in volt
print "Full scale output occurs for a digital input of 111111 = %0.2f V" %FSO
# The output voltage for a digital input of 101011
D0=16
D1=16
D2=0
D3=16
D4=0
D5=16
Vout= ( D0*2**0 + D1*2**1 + D2*2**2 + D3*2**3 + D4*2**4 + D5*2**5 )/64 # in volt
print "The output voltage for digital input of 101011 = %0.2f V" %Vout
#Given data
R=100 # in kohm
R=R*10**3 #in ohm
C=1*10**-6 # in F
V_REF= 5 # in volt
t=0.2 # time taken to read unknown voltage in sec
T=R*C # in sec
Vx= T/t*V_REF # in volt
print "The value of Unknown voltage = %0.1f V" %Vx
#Given data
# For an 8-bit converter reference voltage V_REF be taken as 100 V
V_REF= 100 # in volt
f=75*10**6 # in Hz
# For setting
D7=1
Vout1= V_REF*2**7/2**8 # in volt
print "For D7 = 1, The output voltage = %0.f volt" %Vout1
# since 180-100 = 80 > 50 set D7=1
# For setting
D6=1
Vout2= V_REF*2**6/2**8 # in volt
print "For D6 = 1, The output voltage = %0.f volt" %Vout2
# Hence for setting D7=1 and D6=1 output voltage
Vout3= Vout1+Vout2 # in volt
print "D7 and D6 = 1, The output voltage = %0.f volt" %Vout3
# since 80>75 set D6=1
# For setting D5=1, D6=1 and D7=1
Vout4 = V_REF*2**5/2**8 + Vout1+ Vout2 # in volt
print "For D6 = 1, The output voltage = %0.1f volt" %Vout4
print "All other digits will be set to zero or 1. Output will be accordingly indicated as a result of successive approximation."
print "The Converted 8-bit digital form will be 1110010"
T=1/f #in sec
print "Conversion time = %0.1f ns" %(T*10**9)
#Given data
N=8 # Number of bits
f=1*10**6 # in Hz
T=1/f
Tc= N*T # in second
print "Time of conversion = %0.f µs" %(Tc*10**6)
#Given data
Vin= 2 # in volt
Vout= 10 # in volt
R=100 # kohm
R=R*10**3 # in ohm
C= 0.1 # in miu F
C=C*10**-6 # in F
# Vout= -1/(R*C)*integrate('Vin','t',0,t) = -Vin*t/(R*C)
t= Vout*R*C/Vin # in sec
print "The maximum time upto which the reference voltage can be integrated = %0.f ms" %(t*10**3)
#Given data
n=3
R=1/10**n
fs1=1 # full scale range of 1 v
r1= fs1*R # resolution for full scale range of 1 V
print "Resolution for full scale range of 1 V = %0.3f V" %r1
fs2=10 # full scale range of 10 v
r2= fs2*R # resolution for full scale range of 10 V
print "Resolution for full scale range of 10 V = %0.2f V" %r2
# The display for 2 V reading on 10 V scale of 3*1/2 digital meter would be 02.00 i.e
reading=2
LSD= 5*R # in volt
Total_pos_Error= reading*0.5/100+LSD #in volt
print "Total possible error = %0.3f V" %Total_pos_Error
#Given data
R= 1/10**4 # resolution
print "Resolution of voltmeter = %0.4f" %R
reading1= 16.58
reading2= 0.7254
print "There are 5 digit places in 4½ display, so ",round(reading1,2)," would be displayed as 16.580 V on a 10V range "
print "Any reading up to 4th decimal can be displayed."
print "Hence ",round(reading2,4)," will be displayed as : ",reading2
R= 10*R # resolution on 10 V range
print "Resolution of 10 V range =",round(R,3)," So"
print "0.7254 will be displayed as : ",round(reading2,3),"instead of",reading2
from __future__ import division
#Given data
n=3
R=1/10**n
fs1=10 # full scale range of 10 v
r1= fs1*R # resolution for full scale range of 10 V
print "Resolution for full scale range of 10 V = ",r1
fs2=100 # full scale range of 100 v
r2= fs2*R # resolution for full scale range of 100 V
print "Resolution for full scale range of 100 V = ",r2
print "The display of 14.53 V reading on 10 V scale would be 14.530"
print "The display of 14.53 V reading on 100 V scale would be 0145.3"
from numpy import pi
#Given data
Vmax= 255 # in volt
Vx= 180 # in volt
f=10 # in kHz
f=f*10**3 # in Hz
t= (Vmax-Vx)/(2*pi*f*Vmax) # time taken to read the unknown voltage in second
t=t*10**6 # in micro second
print "Time taken to read the unknown voltage = %0.2f µs" %t
#Given data
f=2.5 # in kHz
f=f*10**3 # in Hz
# Part (i) when
t=0.1 # in sec
count= f*t
print "When GATE ENABLE time is 0.1 sec then the counter count or display = %0.f" %count
# Part (ii) when
t=1 # in sec
count= f*t
print "When GATE ENABLE time is 1 sec then the counter count or display = %0.f" %count
# Part (iii) when
t=10 # in sec
count= f*t
print "When GATE ENABLE time is 10 sec then the counter count = %0.f" %count
#Given data
N=45 # unit less
t=10 # in ms
t=t*10**-3 # in sec
f=N/t # Hz
f=f*10**-3 # in kHz
print "The value of frequency = %0.1f kHz" %f
#Given data
totalPulse= 174 # unit less
t=100 #time period of total pulses in miu s
t=t*10**-6 # in sec
t1= t/totalPulse # time period of one pulse in sec
f= 1/t1 # frequency in Hz
f=f*10**-6 # in MHz
print "The value of frequency = %0.2f MHz" %f
resolution= totalPulse/t # in sec
resolution=resolution*10**-6 # per micro sec
print "Resolution of measurement = %0.2f per µs" %resolution
#Given data
t=1/(2*10**6) # time of one cycle o 2MHz clock in sec
N=500 # number of cycle
t1= N*t # time of 1 cycle by the electronic counter in sec
f= 1/t1 # in Hz
f=f*10**-3 # in kHz
print "The value of frequency of input signal = %0.f kHz" %f