{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 15: Analog to digital converters" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.1 Page No 432" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "n=8 \t\t#8 bit ADC\n", "V1=0\t\t#V, input unipolar voltage\n", "V2=10\t\t#V\n", "Vi=5.2 \t#V, applied input voltage\n", "\n", "#calculation\n", "LSB=V2*1000/(2**n)\n", "Vifs=V2-LSB*10**-3\n", "D=Vi/LSB*10**3\n", "binary=10000101\n", "\n", "#Result\n", "print\"(a)The minimum input voltage is\",LSB,\"mV\"\n", "print\"(b)Input voltage that will cause all 1s at ADC's output\",Vifs,\"V\"\n", "print\"(c)The No of LSB's are \",round(D,0),\"So The digital output code is\",binary\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(a)The minimum input voltage is 39 mV\n", "(b)Input voltage that will cause all 1s at ADC's output 9.961 V\n", "(c)The No of LSB's are 133.0 So The digital output code is 10000101\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.2 Page No 434" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given (from example 15.1)\n", "n=8 \t\t#8 bit ADC\n", "FSR=10\t\t#V\n", "LSB=39.1 #mA, from ex. 15.1\n", "\n", "#Calculation\n", "Vifs=FSR*10**3-LSB+LSB/2.0\n", "\n", "#Result\n", "print\"The voltahe is\",Vifs/1000,\"V\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The voltahe is 9.98045 V\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.3 Page No 435" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "error=0.5 #percent\n", "FSR=10\t\t#V\n", "Vifs=9.961 #From ex 15.1 (c)\n", "\n", "\n", "#Calculation\n", "V=FSR*error/100.0\n", "Vin=Vifs-V*10**-3\n", "\n", "#result\n", "print\"The required voltage is\",round(Vin,2),\"V\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required voltage is 9.96 V\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.4 Page No 438" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "Vin1=100 #mV, input voltage\n", "Vin2=200 #mV, input voltage\n", "\n", "#Calculation\n", "T2=0.833*Vin1 #From eq 15.6(b)\n", "T2_=0.833*Vin2\n", "\n", "#Result\n", "print\"(a)The required tome is\",T2,\"ms\"\n", "print\"(b)The required tome is\",T2_,\"ms\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(a)The required tome is 83.3 ms\n", "(b)The required tome is 166.6 ms\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.5 Page No 439" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "Vin=100 #mV\n", "\n", "#Calculation\n", "Vo=10*Vin #From eq 15.7(c)\n", "\n", "#Result\n", "print\"The digital output is\",Vo,\"counts \"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The digital output is 1000 counts \n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.6 Page No 442" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#given\n", "n=8 \t\t#Bit\n", "t=1 #micros, time for 1 clock pulse\n", "\n", "#Calcultion\n", "Tc=t*(n+1)\n", "\n", "#Result\n", "print\"The required time is\",Tc,\"microsecond\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required time is 9 microsecond\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.7 Page No 450" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "n=8 \t\t#8 bit ADC\n", "t=10 \t\t#micros, conversion time\n", "\n", "#Calculation\n", "import math\n", "fmax=1/(2*math.pi*2**n*t*10**-6)\n", "\n", "#Result\n", "print\"The maximum frequency is\",round(fmax,0),\"Hz\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The maximum frequency is 62.0 Hz\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 15.8 Page No 451" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Given\n", "t=50 \t\t#ns, aperture time\n", "n=8\n", "error=1 #LSB\n", "\n", "#Calculation\n", "import math\n", "fmax=1/(2*math.pi*2**n*t*10**-9)\n", "\n", "#Result\n", "print\"The maximum frequency is\",round(fmax/1000,1),\"Hz\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The maximum frequency is 12.4 Hz\n" ] } ], "prompt_number": 2 } ], "metadata": {} } ] }