{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 14 - Digital-Analog Systems" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_1 Page No. 420" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "n= 3.00\n", "L=2**(n)= 8.00\n", "VFS= 10.00 volts\n", "Q.E=VFS/L= 1.25\n", "Q.E= +0.625,-0.625\n", "Resolution=(100/2**(n))= 12.50 percent\n", "Resolution= 12.50 percent,-12.50 percent\n" ] } ], "source": [ "from __future__ import division \n", "n=3\n", "print \"n= %0.2f\"%(n) # Number of bits \n", "L=2**(n)\n", "print \"L=2**(n)= %0.2f\"%(L)# Number of quantization levels\n", "VFS=10\n", "print \"VFS= %0.2f\"%(VFS),\" volts\" # Maximum value of analog input voltage\n", "QE=VFS/L\n", "print \"Q.E=VFS/L= %0.2f\"%(QE)# Quantization error\n", "print \"Q.E= +0.625,-0.625\"# To make Quantization error symmetrical ittaken as (-Q.E/2) negative and positive value(+Q.E/2)\n", "Resolution=(100/2**(n))#Formulae\n", "print \"Resolution=(100/2**(n))= %0.2f\"%(Resolution),\" percent\"#Resolution\n", "print \"Resolution= %0.2f\"%(+Resolution),\" percent,%0.2f\"%(-Resolution),\" percent\"# Since Resolution is (+)as well as (-)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_2 Page No. 420" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "n= 3.00\n", "L=2**(n)= 8.00\n", "VFS= 1.02 volts\n", "part(i)\n", "LSB=VFS/(2**n)= 0.13 volts\n", "part(ii)\n", "vh= 64 to 192 mV with offset\n", "part(iii)\n", "Inherent error,I.E= (LSB)/2= -0.06 V,+0.06 V\n", "part(iv)\n", "Resolution= 0.00 V\n", "VFS= 1.00 V\n", "k=VFS/(Resolution)= 1.00e+03\n", "number of bits=10\n", "so 10-bit ADC required\n" ] } ], "source": [ "from __future__ import division \n", "n=3\n", "print \"n= %0.2f\"%(n) # Number of bits \n", "L=2**(n)\n", "print \"L=2**(n)= %0.2f\"%(L) # Number of quantization levels\n", "VFS=1024*10**(-3)\n", "print \"VFS= %0.2f\"%(VFS),\" volts\" # Maximum value of analog input voltage\n", "\n", "print \"part(i)\"# Part(i)\n", "LSB=VFS/(2**n)\n", "print \"LSB=VFS/(2**n)= %0.2f\"%(LSB),\" volts\" # Lowest significant bit of 3-bit ADC\n", "\n", "print \"part(ii)\"# Part(ii)\n", "print \"vh= 64 to 192 mV with offset\" # Analog voltage corresponding to binary word 001\n", "\n", "print \"part(iii)\"# Part(iii)\n", "IE=(LSB)/2\n", "print \"Inherent error,I.E= (LSB)/2= -%0.2f\"%(IE),\" V,+%0.2f\"%(IE),\" V\"# Inherent error in each binary word\n", "\n", "print \"part(iv)\"# Part(iv)\n", "Resolution=(1*10**(-3))\n", "print \"Resolution= %0.2f\"%(Resolution),\" V\"#Resolution\n", "VFS=1\n", "print \"VFS= %0.2f\"%(VFS),\" V\" # Maximum value of analog input voltage2\n", "k=VFS/(Resolution)\n", "print \"k=VFS/(Resolution)= %0.2e\"%(k) # 'k' taken only for calculation purpose\n", "print \"number of bits=10\"# since k =[VFS/(Resolution)]is approximately equal to 2**10,\n", "print \"so 10-bit ADC required\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_3 Page No. 421" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VREF= -10.00 V\n", "RF= 5000.00 ohm\n", "R= 10000.00 ohm\n", "vLSB=(-RF*VREF)/(8*R)=0.62 V\n", "vo = -2*vLSB =-1.25 V\n", "vo= -15*vLSB =-9.38 V\n" ] } ], "source": [ "from __future__ import division \n", "VREF=-10\n", "print \"VREF= %0.2f\"%(VREF),\" V\" # Reference voltage\n", "RF=5*10**(3)\n", "print \"RF= %0.2f\"%(RF)+ \" ohm\" #Feedback resistance\n", "R=10*10**(3)\n", "print \"R= %0.2f\"%(R)+ \" ohm\" # resistance\n", "vLSB=(-RF*VREF)/(8*R)# Since IF=I/8,so vLSB=(-RF*IF)=(-RF*I/8)=(-RF*VREF/8*R)\n", "print \"vLSB=(-RF*VREF)/(8*R)=%0.2f\"%(vLSB),\" V\" # Equivalent voltage for binary word 0001\n", "vo=-2*vLSB# Since current IF=I/4\n", "print \"vo = -2*vLSB =%0.2f\"%(vo),\" V\" # Equivalent voltage for binary word 0010=2 (in decimal)\n", "vo=-15*vLSB# Since current IF=I+(I/2)+(I/4)+(I/8)=(15*I/8),so vo=15*VLSB\n", "print \"vo= -15*vLSB =%0.2f\"%(vo),\" V\" # Equivalent voltage for binary word 0010=2 (in decimal)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_4 Page No. 422" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VREF= -10.00 V\n", "RF= 5000.00 ohm\n", "R= 10000.00 ohm\n", "vMSB=-(RF*VREF)/(2*R)=2.50 V\n", "vo2 = vMSB/2 =1.25 V\n", "vo3= (15/8)*vMSB =4.69 V\n" ] } ], "source": [ "from __future__ import division \n", "VREF=-10\n", "print \"VREF= %0.2f\"%(VREF),\" V\" # Reference voltage\n", "RF=5*10**(3)\n", "print \"RF= %0.2f\"%(RF)+ \" ohm\" #Feedback resistance\n", "R=10*10**(3)\n", "print \"R= %0.2f\"%(R)+ \" ohm\" # resistance\n", "vMSB=-(RF*VREF)/(2*R)# Since IF=I/2,so vMSB=(-RF*IF)=(-RF*I/2)=(-RF*VREF/2*R)\n", "print \"vMSB=-(RF*VREF)/(2*R)=%0.2f\"%(vMSB),\" V\" # Equivalent voltage for binary word 1000=8(in decimal)\n", "vo2=vMSB/2# Since current IF=I/4\n", "print \"vo2 = vMSB/2 =%0.2f\"%(vo2),\" V\" # Equivalent voltage for binary word 0100=4 (in decimal)\n", "vo3=(15/8)*vMSB# Since current IF=I+(I/2)+(I/4)+(I/8)+(I/16)=(15*I/6),so vo=(15/8)*VMSB\n", "print \"vo3= (15/8)*vMSB =%0.2f\"%(vo3),\" V\" # Equivalent voltage for binary word 1111=15 (in decimal)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_5 Page No. 422" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "n= 12.00\n", "VFS= 50.00 volts\n", "S=VFS/(2**n)= 0.01 volts\n", "Resolution=(100/2**(n))= -0.02 percent, +0.02 percent\n" ] } ], "source": [ "from __future__ import division \n", "n=12\n", "print \"n= %0.2f\"%(n) # Number of bits\n", "VFS=50\n", "print \"VFS= %0.2f\"%(VFS),\" volts\" # Maximum value of analog input voltage\n", "S=VFS/(2**n)\n", "print \"S=VFS/(2**n)= %0.2f\"%(S),\" volts\" # Maximum quantization error\n", "Resolution=(100/2**(n))#Formulae\n", "print \"Resolution=(100/2**(n))= -%0.2f\"%(Resolution),\" percent, +%0.2f\"%(Resolution),\" percent\"# Since Resolution is (+)as well as (-)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14_7 Page No. 423" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "n= 12.00\n", "t= 5.00e-06 A\n", "Vsp= 10.00 volts\n", "LSB=Vsp/(2**n)= 0.0024 volts\n", "LSB/2= -0.0012 V, -0.00 V\n", "SR=(LSB/2)/t= 244.14 V/s\n", "f = SR/(2*pi*Vsp)=3.89 Hz\n" ] } ], "source": [ "from math import pi\n", "from __future__ import division \n", "n=12\n", "print \"n= %0.2f\"%(n) # Number of bits\n", "t=5*10**(-6)\n", "print \"t= %0.2e\"%(t),\" A\"\n", "Vsp=10\n", "print \"Vsp= %0.2f\"%(Vsp),\" volts\" # value of analog input voltage\n", "LSB=Vsp/(2**n)\n", "print \"LSB=Vsp/(2**n)= %0.4f\"%(LSB),\" volts\" # Lowest significant bit of 12-bit ADC\n", "print \"LSB/2= -%0.4f\"%(LSB/2),\" V, -%0.2f\"%(LSB/2),\" V\" \n", "SR=(LSB/2)/t\n", "print \"SR=(LSB/2)/t= %0.2f\"%(SR),\" V/s\"\n", "fmax=SR/(2*pi*Vsp)\n", "print \"f = SR/(2*pi*Vsp)=%0.2f\"%(fmax),\" Hz\"# Highest frequency allowed at the input" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }