diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | db0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch) | |
tree | b95975d958cba9af36cb1680e3f77205354f6512 /Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb | |
parent | 5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff) | |
download | Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2 Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip |
add books
Diffstat (limited to 'Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb')
-rw-r--r-- | Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb | 654 |
1 files changed, 654 insertions, 0 deletions
diff --git a/Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb b/Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb new file mode 100644 index 00000000..00e88ef0 --- /dev/null +++ b/Linear_Integrated_Circuits_by_J._B._Gupta/chapter08.ipynb @@ -0,0 +1,654 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter-8 : Comparators And Converters" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.2 - Page No 256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "A= 92 # in dB\n", + "A= 10**(92.0/20) \n", + "V_CC= 15 # in volt\n", + "Vout= 30 # in volt\n", + "InputOffsetVoltage= 0 # in V\n", + "InputVoltage= Vout/A # in V\n", + "print \"Input Voltage = %0.4f mV\" %(InputVoltage*10**3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input Voltage = 0.7536 mV\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.3 - Page No " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "R1= 2 # in kohm\n", + "Rf= 390.0 # in kohm\n", + "V_sat= 12 # in V\n", + "Bita= R1/(R1+Rf) \n", + "UTP= Bita*V_sat # in volt\n", + "LTP= -Bita*V_sat # in volt\n", + "print \"Value of UTP = %0.1f mv\" %(UTP*10**3)\n", + "print \"Value of LTP = %0.1f mv\" %(LTP*10**3)\n", + "\n", + "# Note : In the book, there is an error to convert the value of UTP from volts to milli volts." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of UTP = 61.2 mv\n", + "Value of LTP = -61.2 mv\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.5 - Page No 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import exp\n", + "# Given data\n", + "t=0 \n", + "Vc=0 \n", + "Vo=5 #in volt\n", + "# V1= 2*R/(2*R+3*R)= 2/5*Vo\n", + "# Vco= 1/5*VR +4/5*Vo = 1/5*(VR+4*Vo)\n", + "# Req= R||4*R= 4/5*R\n", + "# Vct= Vco*(1-%e**(-t/(Req*C)))= 1/5*(VR+4*Vo)*(1-%e**(-t/(4*R*C/5)))= 1/5*(VR+4*Vo)*(1-%e**(-1.25*t/(R*C)))\n", + "# T= 2*Rf*C*log(1+2*R3/R2)= 2*R*C*log(7/3)= 1.7*R*C\n", + "# t= T/2= .85*R*C, Hence\n", + "Vct=2 #in volt\n", + "# Vct= 1/5*(VR+4*Vo)*(1-%e**1.0625)\n", + "VR= Vct*5/(1-exp(-1.0625))-4*Vo \n", + "print \"Value of VR = %0.2f volt\" %VR" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of VR = -4.72 volt\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.6 - Page No 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from numpy import pi\n", + "from math import asin\n", + "# Given data\n", + "omega= 200*pi # in radians/seconds\n", + "f=omega/(2*pi) # in Hz\n", + "T=1/f # in sec\n", + "T=T*10**3 #in ms\n", + "Vin= 7 #in volt\n", + "t1= 1/omega*asin(6.0/Vin) # in sec\n", + "t1=t1*10**3 # in ms\n", + "# The output of the schmitt trigger is at -10 volt\n", + "t1= T/2+t1 # in ms\n", + "# The output of the schmitt trigger is at +10 volt\n", + "t2= 10-t1 # in ms\n", + "print \"The output of the schmitt trigger is at -10 volt = %0.2f ms\" %t1\n", + "print \"The output of the schmitt trigger is at +10 volt = %0.2f ms\" %t2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The output of the schmitt trigger is at -10 volt = 6.64 ms\n", + "The output of the schmitt trigger is at +10 volt = 3.36 ms\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.7 - Page No 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "R1= 150 # in ohm\n", + "R2= 68.0 # in kohm\n", + "R2=R2*10**3 # in ohm\n", + "Vin= 500 # in mv\n", + "V_sat= 14 #in volt\n", + "V_pos= R1/(R1+R2)*V_sat # in volt\n", + "V_UT= V_pos #in volt\n", + "# In the same way when output is -14 volts and starts increasing in negative direcition \n", + "V_sat=-14 #in volt\n", + "V_pos= R1*V_sat/(R1+R2) # in volt\n", + "V_LT= abs(V_pos) #in volt\n", + "print \"Value of V_UT = %0.4f volts\" %V_UT\n", + "print \"Value of V_LT = %0.4f volts\" %V_LT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of V_UT = 0.0308 volts\n", + "Value of V_LT = 0.0308 volts\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.8 - Page No 262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "V_UT= 5 # in V\n", + "V_LT= -5 # in V\n", + "V_sat= 10 # in V (Assume)\n", + "# V_UT= (R1/(R1+R2))*V_sat = 5\n", + "# V_LT= (-R1/(R1+R2))*V_sat = -5\n", + "# 10*R1/(R+R2)= 5\n", + "V_hy= V_UT-V_LT # in volt\n", + "print \"Hysteresis voltage = %0.f volt\" %V_hy" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hysteresis voltage = 10 volt\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.9 - Page No 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "V_REF= 10 # in V\n", + "V_REF= float(V_REF) # converting into float\n", + "MSB2= V_REF/2 # in volt\n", + "print \"The second MSB weight = %0.f volt\" %MSB2\n", + "MSB3= V_REF/4 # in volt\n", + "print \"The third MSB weight = %0.1f volt\"%MSB3\n", + "MSB4= V_REF/8 # in volt\n", + "print \"The forth MSB (or LSB) weight = %0.2f volt\" %MSB4\n", + "DAC= MSB4 \n", + "print \"The resolution of the DAC = %0.2f volt\" %DAC\n", + "FullScaleOutput= V_REF+MSB2+MSB3+MSB4 #in volt\n", + "print \"Full scale output = %0.2f volt\" %FullScaleOutput\n", + "print \"IF Rf is reduced to one-forth then the value of full scale output =\" ,round(FullScaleOutput/4,4),\" volt\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The second MSB weight = 5 volt\n", + "The third MSB weight = 2.5 volt\n", + "The forth MSB (or LSB) weight = 1.25 volt\n", + "The resolution of the DAC = 1.25 volt\n", + "Full scale output = 18.75 volt\n", + "IF Rf is reduced to one-forth then the value of full scale output = 4.6875 volt\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.10 - Page No 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "V_REF= -5 # in V\n", + "V_B= 0 # in volt\n", + "V_A= -5 # in volt\n", + "V_A= float(V_A) # converting into float\n", + "V_C=V_A \n", + "V_D=V_C \n", + "Vout= -1*(V_A+V_B/2+V_C/4+V_D/8) # in volt\n", + "print \"Output voltage = %0.3f volt\" %Vout" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output voltage = 6.875 volt\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.11 - Page No 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "Dn=16 # in volt\n", + "Dn= float (Dn) #converting into float\n", + "MSB1= Dn/2 # in volt\n", + "print \"The first MSB output = %0.f volt\" %MSB1\n", + "MSB2= Dn/4 # in volt\n", + "print \"The second MSB output = %0.f volt\" %MSB2\n", + "MSB3= Dn/8 # in volt\n", + "print \"The third MSB output = %0.f volt\" %MSB3\n", + "MSB4= Dn/16 # in volt\n", + "print \"The forth MSB output = %0.f volt\" %MSB4\n", + "MSB5= Dn/32 # in volt\n", + "print \"The fifth MSB output = %0.1f volt\" %MSB5\n", + "MSB6= Dn/64 # in volt\n", + "print \"The sixth MSB (LSB) output = %0.2f volt\" %MSB6\n", + "resolution= MSB6 # in volt\n", + "print \"The resolution = %0.2f volt\" %resolution\n", + "fullScaleOutput= MSB1+MSB2+MSB3+MSB4+MSB5+MSB6 \n", + "print \"Full scale output occurs for digital input of 111111 = %0.2f volt\" %fullScaleOutput\n", + "# For digital input 101011\n", + "D0=16 \n", + "D1=16 \n", + "D2=0 \n", + "D3=16 \n", + "D4=0 \n", + "D5=16 \n", + "\n", + "Vout= float(D0*2**0 + D1*2**1 + D2*2**2 + D3*2**3 + D4*2**4 + D5*2**5)/2**6 # in volt\n", + "print \"The voltage output for a digital input of 101011 = %0.2f volt\" %Vout" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The first MSB output = 8 volt\n", + "The second MSB output = 4 volt\n", + "The third MSB output = 2 volt\n", + "The forth MSB output = 1 volt\n", + "The fifth MSB output = 0.5 volt\n", + "The sixth MSB (LSB) output = 0.25 volt\n", + "The resolution = 0.25 volt\n", + "Full scale output occurs for digital input of 111111 = 15.75 volt\n", + "The voltage output for a digital input of 101011 = 10.75 volt\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.12 - Page No 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "# For the word 100100\n", + "N=6 # Number of bits\n", + "a5= 1 # Value of bits\n", + "a4= 0 # Value of bits\n", + "a3= 0 # Value of bits\n", + "a2= 1 # Value of bits\n", + "a1= 0 # Value of bits\n", + "a0= 0 # Value of bits\n", + "Vo= 3.6 # in volt\n", + "# Formula Vo= (2**(N-1)*a5 + 2**(N-2)*a4 + 2**(N-3)*a3 + 2**(N-4)*a2 + 2**(N-5)*a1 + 2**(N-6)*a0 ) * K\n", + "K= Vo/(2**(N-1)*a5 + 2**(N-2)*a4 + 2**(N-3)*a3 + 2**(N-4)*a2 + 2**(N-5)*a1 + 2**(N-6)*a0 ) \n", + "# For the word 110011\n", + "N=6 # Number of bits\n", + "a5= 1 # Value of bits\n", + "a4= 1 # Value of bits\n", + "a3= 0 # Value of bits\n", + "a2= 0 # Value of bits\n", + "a1= 1 # Value of bits\n", + "a0= 1 # Value of bits\n", + "Vo= (2**(N-1)*a5 + 2**(N-2)*a4 + 2**(N-3)*a3 + 2**(N-4)*a2 + 2**(N-5)*a1 + 2**(N-6)*a0 ) * K # in volt\n", + "print \"(i) : The value of Vo for the word 110011 = %0.1f volt\" %Vo\n", + "\n", + "# Part(ii)\n", + "# For the word 1010\n", + "N=4 # Number of bits\n", + "a3= 1 # Value of bits\n", + "a2= 0 # Value of bits\n", + "a1= 1 # Value of bits\n", + "a0= 0 # Value of bits\n", + "VR= 6 # in volt\n", + "Vo= float(VR)/2**N*( 2**(N-1)*a3 + 2**(N-2)*a2 + 2**(N-3)*a1 + 2**(N-4)*a0 ) \n", + "print \"(ii) : Value of output voltage = %0.2f volt\" %Vo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) : The value of Vo for the word 110011 = 5.1 volt\n", + "(ii) : Value of output voltage = 3.75 volt\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.13 - Page No 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "R=100 # in kohm\n", + "R=R*10**3 # in ohm\n", + "C= 1 # in micro F\n", + "C=C*10**-6 # in F\n", + "V_REF= 5 # in volt\n", + "t=0.2 # time taken to read an unknown voltage in second\n", + "T=R*C # in second\n", + "Vx= T/t*V_REF # in volt\n", + "print \"Unknown voltage = %0.1f volt\" %Vx" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Unknown voltage = 2.5 volt\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.14 - Page No 277\n", + " " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "f=75 # in MHz\n", + "f=f*10**6 # in Hz\n", + "# For an 8-bit converter reference voltage\n", + "V_REF= 100 # in volt\n", + "# For setting D7=1\n", + "Vo_7= V_REF*2**7/2**8 #in volt\n", + "# For setting D6=1\n", + "Vo_6= V_REF*2**6/2**8 #in volt\n", + "# For setting D7=1 and D6=1\n", + "Vo_76= Vo_7+Vo_6 #in volt\n", + "# For setting D5=1 D6=1 and D7=1\n", + "Vo_5= float(V_REF*2**5)/2**8+Vo_7+Vo_6 #in volt\n", + "print \"For setting D7=1 output voltage = %0.f volt\" %Vo_7\n", + "print \"For setting D6=1 output voltage = %0.f volt\" %Vo_6\n", + "print \"For setting D7=1 and D6=1 output voltage = %0.f volt\" %Vo_76\n", + "print \"For setting D5=1, D6=1 and D7=1 output voltage = %0.1f volt\" %Vo_5\n", + "T=float(1.0/f) # in sec\n", + "print \"Conversion time = %0.1f ns\" %(T*10**9)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For setting D7=1 output voltage = 50 volt\n", + "For setting D6=1 output voltage = 25 volt\n", + "For setting D7=1 and D6=1 output voltage = 75 volt\n", + "For setting D5=1, D6=1 and D7=1 output voltage = 87.5 volt\n", + "Conversion time = 13.3 ns\n" + ] + } + ], + "prompt_number": 49 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.15 - Page No 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "f=1 # in MHz\n", + "f=f*10**6 # in Hz\n", + "f= float(f) # converting into float\n", + "T=1/f # conversion time in sec\n", + "N=8 # number of bits\n", + "tc= N*T # in sec\n", + "print \"Time of Conversion = %0.f micro sec : \" %(tc*10**6)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time of Conversion = 8 micro sec : \n" + ] + } + ], + "prompt_number": 52 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.16 - Page No 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "Vin= 2 #in volt\n", + "Vout= 10 #in volt\n", + "R=100 # in kohm\n", + "R=R*10**3 #in ohm\n", + "C=0.1 # in micro F\n", + "C=C*10**-6 #in F\n", + "# Formula Vout = -1/(R*C)*integrate('Vin','t',0,t) = -Vin*t/(R*C)\n", + "t= Vout*R*C/Vin # in sec\n", + "print \"Maximum time upto which the reference voltage can be integrated,\"\n", + "print \"t =\",round(t,2),\"second =\",int(round(t*10**3)),\"ms\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum time upto which the reference voltage can be integrated,\n", + "t = 0.05 second = 50 ms\n" + ] + } + ], + "prompt_number": 69 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example : 8.17 - Page No 280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given data\n", + "C=0.1 # in nF\n", + "C=C*10**-9 #in F\n", + "V=5 #in V\n", + "t=1 # in micro S\n", + "t=t*10**-6 # in sec\n", + "# v= V*(1-%e**(-t/(R*C)))\n", + "# Since hold value does not drop by more than 0.5% or by 0.005 V, hold value is 0.995 V, Thus\n", + "# 0.995*V= V*(1-%e**(-t/(R*C)))\n", + "# or %e**(-t/(R*C))= 1-0.995 = 0.005\n", + "R= t/(C*math.log(1/0.005)) # in ohm\n", + "I= V/R*(1-exp(-t/(R*C))) # Maximum currnet through R in amphere\n", + "print \"Maximum permissible leakage current through the hold capacitor = %0.3f mA\" %(I*10**3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum permissible leakage current through the hold capacitor = 2.636 mA\n" + ] + } + ], + "prompt_number": 48 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |