{ "metadata": { "name": "", "signature": "sha256:3339b00236a2f81e5e5e7b7f9b1a7ab1f4ae4cfea924466604e158fa53da71b7" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter - 5 : Digital Meters" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.1 - Page No : 117" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "#Given data\n", "V_REF= 10 # in volt\n", "w2= V_REF/2 # The second MSB weight in volt\n", "print \"The second MSB weight = %0.f V\" %w2\n", "w3= V_REF/4 # The third MSB weight in volt\n", "print \"The third MSB weight = %0.1f V\" %w3\n", "w4= V_REF/8 # The forth MSB weight in volt\n", "print \"The forth MSB weight = %0.2f V\" %w4\n", "\n", "# (i)\n", "r_DAC= w4 # resolution of the DAC in volt\n", "print \"(i) : Resolutio of the DAC = %0.2f V\" %r_DAC \n", "\n", "#(ii)\n", "FSO= V_REF+w2+w3+w4 #full scale output in volt\n", "print \"(ii) : Full scale output = %0.2f V\" %FSO\n", "\n", "# (iii)\n", "FSO_R= FSO/4 # full scale output when the feedback resistor is made one fourth of R in volt\n", "print \"(iii) : The full scale output when the feedback resistor is made one fourth of R i volt = %0.4f\" %FSO_R" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The second MSB weight = 5 V\n", "The third MSB weight = 2.5 V\n", "The forth MSB weight = 1.25 V\n", "(i) : Resolutio of the DAC = 1.25 V\n", "(ii) : Full scale output = 18.75 V\n", "(iii) : The full scale output when the feedback resistor is made one fourth of R i volt = 4.6875\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.2 - Page No : 117" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "V_REF= -5 # in volt\n", "V_A= -5 # in volt\n", "V_C=V_A # in volt\n", "V_D=V_C # in volt\n", "V_B= 0 \n", "Vout= -1*(V_A+V_B/2+V_C/4+V_D/8) \n", "print \"Output voltage = %0.3f V\" %Vout " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Output voltage = 6.875 V\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.3\n", " - Page No :" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "D=16 \n", "D1= D/2 # first MSB output in volt\n", "print \"First MSB output = %0.f V\" %D1 \n", "D2= D/4 # second MSB output in volt\n", "print \"Second MSB output = %0.f V\" %D2 \n", "D3= D/8 # third MSB output in volt\n", "print \"Third MSB output = %0.f V\" %D3\n", "D4= D/16 # fourth MSB output in volt\n", "print \"Fourth MSB output = %0.f V\" %D4 \n", "D5= D/32 # fifth MSB output in volt\n", "print \"Fifth MSB output = %0.1f V\" %D5\n", "D6= D/64 # sixth MSB (LSB) output in volt\n", "print \"Sixth MSB (LSB) output = %0.2f V\" %D6 \n", "print \"The resolution is equal to the weight of the LSB = %0.2f V\" %D6\n", "# Full scale output occurs for a digital input of 111111\n", "FSO= D1+D2+D3+D4+D5+D6 # in volt\n", "print \"Full scale output occurs for a digital input of 111111 = %0.2f V\" %FSO\n", "# The output voltage for a digital input of 101011\n", "D0=16 \n", "D1=16 \n", "D2=0 \n", "D3=16 \n", "D4=0 \n", "D5=16 \n", "Vout= ( D0*2**0 + D1*2**1 + D2*2**2 + D3*2**3 + D4*2**4 + D5*2**5 )/64 # in volt\n", "print \"The output voltage for digital input of 101011 = %0.2f V\" %Vout" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "First MSB output = 8 V\n", "Second MSB output = 4 V\n", "Third MSB output = 2 V\n", "Fourth MSB output = 1 V\n", "Fifth MSB output = 0.5 V\n", "Sixth MSB (LSB) output = 0.25 V\n", "The resolution is equal to the weight of the LSB = 0.25 V\n", "Full scale output occurs for a digital input of 111111 = 15.75 V\n", "The output voltage for digital input of 101011 = 10.75 V\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.4 - Page No : 123" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "R=100 # in kohm\n", "R=R*10**3 #in ohm\n", "C=1*10**-6 # in F\n", "V_REF= 5 # in volt\n", "t=0.2 # time taken to read unknown voltage in sec\n", "T=R*C # in sec\n", "Vx= T/t*V_REF # in volt\n", "print \"The value of Unknown voltage = %0.1f V\" %Vx" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of Unknown voltage = 2.5 V\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.5 - Page No : 124" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "# For an 8-bit converter reference voltage V_REF be taken as 100 V\n", "V_REF= 100 # in volt\n", "f=75*10**6 # in Hz\n", "# For setting\n", "D7=1 \n", "Vout1= V_REF*2**7/2**8 # in volt\n", "print \"For D7 = 1, The output voltage = %0.f volt\" %Vout1\n", "# since 180-100 = 80 > 50 set D7=1\n", "\n", "# For setting\n", "D6=1 \n", "Vout2= V_REF*2**6/2**8 # in volt\n", "print \"For D6 = 1, The output voltage = %0.f volt\" %Vout2\n", "# Hence for setting D7=1 and D6=1 output voltage\n", "Vout3= Vout1+Vout2 # in volt\n", "print \"D7 and D6 = 1, The output voltage = %0.f volt\" %Vout3\n", "# since 80>75 set D6=1\n", "# For setting D5=1, D6=1 and D7=1\n", "Vout4 = V_REF*2**5/2**8 + Vout1+ Vout2 # in volt\n", "print \"For D6 = 1, The output voltage = %0.1f volt\" %Vout4\n", "print \"All other digits will be set to zero or 1. Output will be accordingly indicated as a result of successive approximation.\"\n", "print \"The Converted 8-bit digital form will be 1110010\"\n", "T=1/f #in sec\n", "print \"Conversion time = %0.1f ns\" %(T*10**9)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For D7 = 1, The output voltage = 50 volt\n", "For D6 = 1, The output voltage = 25 volt\n", "D7 and D6 = 1, The output voltage = 75 volt\n", "For D6 = 1, The output voltage = 87.5 volt\n", "All other digits will be set to zero or 1. Output will be accordingly indicated as a result of successive approximation.\n", "The Converted 8-bit digital form will be 1110010\n", "Conversion time = 13.3 ns\n" ] } ], "prompt_number": 27 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.6 - Page No : 124" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "N=8 # Number of bits\n", "f=1*10**6 # in Hz\n", "T=1/f \n", "Tc= N*T # in second\n", "print \"Time of conversion = %0.f \u00b5s\" %(Tc*10**6)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Time of conversion = 8 \u00b5s\n" ] } ], "prompt_number": 29 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.7 - Page No : 124" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "Vin= 2 # in volt\n", "Vout= 10 # in volt\n", "R=100 # kohm\n", "R=R*10**3 # in ohm\n", "C= 0.1 # in miu F\n", "C=C*10**-6 # in F\n", "# Vout= -1/(R*C)*integrate('Vin','t',0,t) = -Vin*t/(R*C)\n", "t= Vout*R*C/Vin # in sec\n", "print \"The maximum time upto which the reference voltage can be integrated = %0.f ms\" %(t*10**3) " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The maximum time upto which the reference voltage can be integrated = 50 ms\n" ] } ], "prompt_number": 30 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.8 - Page No : 134" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "n=3 \n", "R=1/10**n \n", "fs1=1 # full scale range of 1 v\n", "r1= fs1*R # resolution for full scale range of 1 V\n", "print \"Resolution for full scale range of 1 V = %0.3f V\" %r1\n", "fs2=10 # full scale range of 10 v\n", "r2= fs2*R # resolution for full scale range of 10 V\n", "print \"Resolution for full scale range of 10 V = %0.2f V\" %r2\n", "# The display for 2 V reading on 10 V scale of 3*1/2 digital meter would be 02.00 i.e\n", "reading=2 \n", "LSD= 5*R # in volt\n", "Total_pos_Error= reading*0.5/100+LSD #in volt\n", "print \"Total possible error = %0.3f V\" %Total_pos_Error" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Resolution for full scale range of 1 V = 0.001 V\n", "Resolution for full scale range of 10 V = 0.01 V\n", "Total possible error = 0.015 V\n" ] } ], "prompt_number": 31 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.9 - Page No : 134" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "R= 1/10**4 # resolution\n", "print \"Resolution of voltmeter = %0.4f\" %R\n", "reading1= 16.58 \n", "reading2= 0.7254 \n", "print \"There are 5 digit places in 4\u00bd display, so \",round(reading1,2),\" would be displayed as 16.580 V on a 10V range \"\n", "print \"Any reading up to 4th decimal can be displayed.\"\n", "print \"Hence \",round(reading2,4),\" will be displayed as : \",reading2\n", "R= 10*R # resolution on 10 V range\n", "print \"Resolution of 10 V range =\",round(R,3),\" So\"\n", "print \"0.7254 will be displayed as : \",round(reading2,3),\"instead of\",reading2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Resolution of voltmeter = 0.0001\n", "There are 5 digit places in 4\u00bd display, so 16.58 would be displayed as 16.580 V on a 10V range \n", "Any reading up to 4th decimal can be displayed.\n", "Hence 0.7254 will be displayed as : 0.7254\n", "Resolution of 10 V range = 0.001 So\n", "0.7254 will be displayed as : 0.725 instead of 0.7254\n" ] } ], "prompt_number": 37 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.10 - Page No : 135" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "#Given data\n", "n=3 \n", "R=1/10**n \n", "fs1=10 # full scale range of 10 v\n", "r1= fs1*R # resolution for full scale range of 10 V\n", "print \"Resolution for full scale range of 10 V = \",r1\n", "fs2=100 # full scale range of 100 v\n", "r2= fs2*R # resolution for full scale range of 100 V\n", "print \"Resolution for full scale range of 100 V = \",r2\n", "print \"The display of 14.53 V reading on 10 V scale would be 14.530\"\n", "print \"The display of 14.53 V reading on 100 V scale would be 0145.3\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Resolution for full scale range of 10 V = 0.01\n", "Resolution for full scale range of 100 V = 0.1\n", "The display of 14.53 V reading on 10 V scale would be 14.530\n", "The display of 14.53 V reading on 100 V scale would be 0145.3\n" ] } ], "prompt_number": 43 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.11 - Page No : 135" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import pi\n", "#Given data\n", "Vmax= 255 # in volt\n", "Vx= 180 # in volt\n", "f=10 # in kHz\n", "f=f*10**3 # in Hz\n", "t= (Vmax-Vx)/(2*pi*f*Vmax) # time taken to read the unknown voltage in second\n", "t=t*10**6 # in micro second\n", "print \"Time taken to read the unknown voltage = %0.2f \u00b5s\" %t " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Time taken to read the unknown voltage = 4.68 \u00b5s\n" ] } ], "prompt_number": 45 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.12 - Page No : 146" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "f=2.5 # in kHz\n", "f=f*10**3 # in Hz\n", "# Part (i) when\n", "t=0.1 # in sec\n", "count= f*t \n", "print \"When GATE ENABLE time is 0.1 sec then the counter count or display = %0.f\" %count\n", "# Part (ii) when\n", "t=1 # in sec\n", "count= f*t \n", "print \"When GATE ENABLE time is 1 sec then the counter count or display = %0.f\" %count\n", "# Part (iii) when\n", "t=10 # in sec\n", "count= f*t \n", "print \"When GATE ENABLE time is 10 sec then the counter count = %0.f\" %count" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "When GATE ENABLE time is 0.1 sec then the counter count or display = 250\n", "When GATE ENABLE time is 1 sec then the counter count or display = 2500\n", "When GATE ENABLE time is 10 sec then the counter count = 25000\n" ] } ], "prompt_number": 47 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.13 - Page No : 147" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "N=45 # unit less\n", "t=10 # in ms\n", "t=t*10**-3 # in sec\n", "f=N/t # Hz\n", "f=f*10**-3 # in kHz\n", "print \"The value of frequency = %0.1f kHz\" %f" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of frequency = 4.5 kHz\n" ] } ], "prompt_number": 49 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.14 - Page No : 147" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "totalPulse= 174 # unit less\n", "t=100 #time period of total pulses in miu s\n", "t=t*10**-6 # in sec\n", "t1= t/totalPulse # time period of one pulse in sec\n", "f= 1/t1 # frequency in Hz\n", "f=f*10**-6 # in MHz\n", "print \"The value of frequency = %0.2f MHz\" %f \n", "resolution= totalPulse/t # in sec\n", "resolution=resolution*10**-6 # per micro sec\n", "print \"Resolution of measurement = %0.2f per \u00b5s\" %resolution" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of frequency = 1.74 MHz\n", "Resolution of measurement = 1.74 per \u00b5s\n" ] } ], "prompt_number": 51 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example : 5.15 - Page No : 147" ] }, { "cell_type": "code", "collapsed": false, "input": [ " #Given data\n", "t=1/(2*10**6) # time of one cycle o 2MHz clock in sec\n", "N=500 # number of cycle\n", "t1= N*t # time of 1 cycle by the electronic counter in sec\n", "f= 1/t1 # in Hz\n", "f=f*10**-3 # in kHz\n", "print \"The value of frequency of input signal = %0.f kHz\" %f" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of frequency of input signal = 4 kHz\n" ] } ], "prompt_number": 52 } ], "metadata": {} } ] }