{ "metadata": { "name": "", "signature": "sha256:59cd343af66270b4e29714c4ca9503ff6321478ece54592a85a310df01cfd603" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter05 : Waveform Generators" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.1 : page 170" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "# given data \n", "fo=1 #in KHz\n", "# assume R1=1 Kohm and C=1 uF\n", "R1=1 #in Kohm\n", "C=1 #in uF\n", "R2=1.16*R1 #in Kohm\n", "R=1/(2*fo*10**3*C*10**-6)\n", "print \"Value of R1 = %0.2f kohm\" %R1\n", "print \"Value of R2 = %0.2f kohm\" %R2\n", "print \"Value of R = %0.2f ohm\" %R\n", "print \"Value of C = %0.2f uF\"%C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R1 = 1.00 kohm\n", "Value of R2 = 1.16 kohm\n", "Value of R = 500.00 ohm\n", "Value of C = 1.00 uF\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.2 : page 170" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import log\n", "# given data \n", "fo=1 #in KHz\n", "BETA=0.6 #unitless\n", "print \"As choosing R1=1 Kohm\"\n", "# assume R1=1 Kohm and C=1 uF\n", "R1=1 #in Kohm\n", "C=1 #in uF\n", "R=1/(2*fo*10**3*C*10**-6*log((1+BETA)/(1-BETA))) \n", "print \"Value of R = %0.2f ohm\"%R\n", "#Answer in the book is wrong" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "As choosing R1=1 Kohm\n", "Value of R = 360.67 ohm\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.3 : page 170" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "BETA=0.41 #unitless\n", "R=2.7 #in Kohm\n", "C=0.1 #in uF\n", "fo=1/(2*R*C*log((1+BETA)/(1-BETA))) #in KHz\n", "print \"Output signal frequency = %0.3f khz\"%fo," ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Output signal frequency = 2.126 khz\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.4 : page 171" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "Ton=100 #in mSEC\n", "Toff=200 #in mSEC\n", "BETA=0.2 #unitless\n", "#Let R1=1 Kohm\n", "R1=1 #in Kohm\n", "R2=R1*(1-BETA)/BETA #in Kohm\n", "# Assuming C=10 uF\n", "C=10 #in uF\n", "R3=Ton*10**-3/(C*10**-6*0.41) #in Kohm\n", "R4=Toff*10**-3/(C*10**-6*0.41) # in Kohm\n", "print \"Value of R1 = %0.2f kohm\"%R1\n", "print \"Value of R2 = %0.2f kohm\"%R2\n", "print \"Value of R3 = %0.2f kohm\"%(R3/1000)\n", "print \"Value of R4 = %0.2f kohm\"%(R4/1000)\n", "print \"Value of C = %0.2f uF\"%C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R1 = 1.00 kohm\n", "Value of R2 = 4.00 kohm\n", "Value of R3 = 24.39 kohm\n", "Value of R4 = 48.78 kohm\n", "Value of C = 10.00 uF\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.5 : page 171" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "Vo=7.5 #in Volt\n", "fo=1 # in KHz\n", "DutyCycle=60 #in %\n", "Vz=6.8 # in volt\n", "Vz1=6.8 # in volt\n", "Vz2=6.8 # in volt\n", "VD=0.7 # in volt\n", "T=1/fo #in mSec\n", "# duty cycle 60% gives Ton & Toff\n", "Ton=0.6*T #in mSec\n", "Toff=T-Ton #in mSec\n", "# choosing R2=1.16*R1\n", "R1=1 #in Kohm\n", "C=0.1 #in uF\n", "R2=1.16*R1 #in Kohm\n", "R3=Ton*10**-3/(C*10**-6) #in ohm\n", "R4=Toff*10**-3/(C*10**-6) #in ohm\n", "print \"Value of R1 = %0.2f kohm\"%R1\n", "print \"Value of R2 = %0.2f kohm\"%R2\n", "print \"Value of R3 = %0.2f kohm\"%(R3/1000)\n", "print \"Value of R4 = %0.2f kohm\"%(R4/1000)\n", "print \"Value of C = %0.2f uF\"%C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R1 = 1.00 kohm\n", "Value of R2 = 1.16 kohm\n", "Value of R3 = 6.00 kohm\n", "Value of R4 = 4.00 kohm\n", "Value of C = 0.10 uF\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.6 : page 179" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "RA=6.8 #in Kohm\n", "RB=3.3 #in Kohm\n", "C=0.1 #in uF\n", "fo=1.45/((RA+2*RB)*C) # in KHz\n", "d=(RA+RB)/(RA+2*RB) \n", "print \"Frequency of oscillation = %0.2f khz\"%fo\n", "print \"Duty cycle = %0.2f %%\" %(d*100)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Frequency of oscillation = 1.08 khz\n", "Duty cycle = 75.37 %\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.7 : page 179" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=50 #in kHz\n", "d=75/100 #unitless\n", "C=1 #in nF\n", "print \"RA+2RB=28.9 kohm\" \n", "print \"d=0.75=(RA+RB)/(RA+2*RB)\" \n", "print \"It gives RA=2*RB\" \n", "RA=28.9/2 # in kohm\n", "RB=RA/2 #in kohm\n", "print \"Value of RA = %0.1f kohm \" %RA\n", "print \"Value of RB = %0.2f kohm \" %RB" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "RA+2RB=28.9 kohm\n", "d=0.75=(RA+RB)/(RA+2*RB)\n", "It gives RA=2*RB\n", "Value of RA = 14.4 kohm \n", "Value of RB = 7.22 kohm \n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.8 : page 180" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=800 # in Hz\n", "d=60/100 #unitless\n", "T=1/fo #in Sec\n", "TC=0.6*T #in Sec\n", "TD=T-TC #in Sec\n", "C=0.01 #in uF\n", "C2=10 #in uF\n", "RB=TD/(0.69*C*10**-6) #in ohm\n", "RA=(TC-0.69*RB*C*10**-6)/(0.69*C*10**-6) #in ohm\n", "print \"Value of RA = %0.2f kohm \" %(RA/1000)\n", "print \"Value of RB = %0.2f kohm \" %(RB/1000)\n", "print \"Value of C = %0.2f uF\" %C\n", "print \"Value of C2 = %0.2f uF\" %C2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of RA = 36.23 kohm \n", "Value of RB = 72.46 kohm \n", "Value of C = 0.01 uF\n", "Value of C2 = 10.00 uF\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.9 : page 180" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=700 # in Hz\n", "d=50/100 #unitless\n", "T=1/fo #in Sec\n", "TC=0.5*T #in Sec\n", "TD=T-TC #in Sec\n", "C=0.1 #in uF\n", "RB=TD/(0.69*C*10**-6) #in ohm\n", "RA=TC/(0.69*C*10**-6) #in ohm\n", "print \"Value of RA = %0.1f kohm \" %(RA/1000)\n", "print \"Value of RB = %0.1f kohm \" %(RB/1000)\n", "print \"We have TC = TD = %0.3f ms\" %(TC*1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of RA = 10.4 kohm \n", "Value of RB = 10.4 kohm \n", "We have TC = TD = 0.714 ms\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.10 : page 181" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=1 # in KHz\n", "d=40/100 #unitless\n", "T=1/fo #in Sec\n", "TC=0.4*T #in mSec\n", "TD=T-TC #in mSec\n", "C=0.1 #in uF\n", "RB=TD*10**-3/(0.69*C*10**-6) #in ohm\n", "RA=TC*10**-3/(0.69*C*10**-6) #in ohm\n", "print \"Value of RA = %0.2f kohm \" %(RA/1000)\n", "print \"Value of RB = %0.2f kohm \" %(RB/1000)\n", "print \"We have TC = %0.2f ms\" %(TC)\n", "print \"We have TD = %0.2f ms\" %(TD)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of RA = 5.80 kohm \n", "Value of RB = 8.70 kohm \n", "We have TC = 0.40 ms\n", "We have TD = 0.60 ms\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.11 : page 186" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "T=100 # in uSec\n", "C=15 #in \n", "R=T*10**-6/(1.1*C*10**-9) #in ohm\n", "print \"To obtain a output pulse at 100uSec resistor required = %0.2f kohm\"%(R/1000)\n", "#Note : in the question 15uF is given but in the solution 15nF is used in the book" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "To obtain a output pulse at 100uSec resistor required = 6.06 kohm\n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.12 : page 187" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "VCC=15 #in Volt\n", "T=10 #in mSec\n", "ILED=20 #in mA\n", "Vf=1.4 #in Volt\n", "VBE=0.7 #in Volt\n", "VCEsat=0.2 #in Volt\n", "C=0.22 #in uF\n", "R=T*10**-3/(1.1*C*10**-6) #in ohm\n", "#output of the device \n", "Vo=VCC-2*VBE-VCEsat \n", "R5=(Vo-Vf)/(ILED*10**-3) #in ohm\n", "print \"Value of R = %0.2f kohm\" %(R/1000)\n", "print \"Output of the device = %0.2f Volt\" %(Vo)\n", "print \"Value of RB = %0.2f ohm\" %(R5)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R = 41.32 kohm\n", "Output of the device = 13.40 Volt\n", "Value of RB = 600.00 ohm\n" ] } ], "prompt_number": 20 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.13 : page 187" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=2 # in KHz\n", "C=0.01 #in uF\n", "T=1/fo #in mSec\n", "tp=1.2*T #in mSec\n", "R=tp*10**-3/(1.1*C*10**-6) #in ohm\n", "print \"Period of trigger pulse = %0.2f ms\" %(tp)\n", "print \"Value of R = %0.2f kohm\"%(R/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Period of trigger pulse = 0.60 ms\n", "Value of R = 54.55 kohm\n" ] } ], "prompt_number": 21 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.14 : page 193" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fo=2 # in KHz\n", "Vopp=5 #in volts\n", "Vsat=13 #in Volts\n", "# Let the value of R2 used be 10 Kohm \n", "R2=10 #in Kohm\n", "R3=(2*R2*Vsat)/Vopp #in Kohm \n", "# Let C1=0.1 uF\n", "C1=0.1 # in uF\n", "R1=R3/(4*fo*10**3*C1*10**-6*R2) # in ohm\n", "print \"Value of R1 = %0.2f kohm\" %(R1/1000)\n", "print \"Value of C1 = %0.2f uF\" %(C1)\n", "print \"Value of R2 = %0.2f kohm\" %R2\n", "print \"Value of R3 = %0.2f kohm\" %R3 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R1 = 6.50 kohm\n", "Value of C1 = 0.10 uF\n", "Value of R2 = 10.00 kohm\n", "Value of R3 = 52.00 kohm\n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.15 : page 193" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "Vcc=12 #in Volt\n", "R1=10 #in Kohm\n", "R2=100 #in Kohm\n", "R3=820 #in Kohm\n", "# Let Vsat=10 volt\n", "Vsat=10 #in volt\n", "# part (a)\n", "Vopp=2*R2*Vsat/R3 #in Volt\n", "print \"Amplitude of triangular wave = %0.2f Volt\" %(Vopp)\n", "Vopp=Vsat-(-Vsat) # in Volt\n", "print \"Amplitude of square wave = %0.2f Volt\" %(Vopp)\n", "# part (b)\n", "C1=0.1 # in uF\n", "fo=R3*1000/(4*R1*1000*R2*1000*C1*10**-6) # in Hz\n", "print \"Frequency = %0.2f kHz\" %(fo/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Amplitude of triangular wave = 2.44 Volt\n", "Amplitude of square wave = 20.00 Volt\n", "Frequency = 2.05 kHz\n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.16 : page 205" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# given data \n", "fo=1 # in KHz\n", "# choose C=.01 uF\n", "C=.01 # in uF\n", "R=1/(2*pi*sqrt(6)*fo*1000*C*10**-6) # in ohm\n", "R1=35.6 # in Kohm\n", "RF=29*R1 #in ohm\n", "print \"Value of C = %0.2f uF\" %(C)\n", "print \"Value of R = %0.2f kohm\" %(R/1000)\n", "print \"Value of R1 = %0.2f kohm\" %R1\n", "print \"Value of RF = %0.2f Mohm\" %(RF/1000) \n", "# Note : Answer in the book is wrong" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of C = 0.01 uF\n", "Value of R = 6.50 kohm\n", "Value of R1 = 35.60 kohm\n", "Value of RF = 1.03 Mohm\n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.17 : page 206" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# given data \n", "fo=1 # in KHz\n", "# choose C=.01 uF\n", "C=.01 # in uF\n", "R=1/(2*pi*fo*1000*C*10**-6) # in ohm\n", "# choosing R1=10 Kohm\n", "R1=10 # in Kohm\n", "RF=2*R1 #in Kohm\n", "print \"Value of C = %0.2f uF\" %(C)\n", "print \"Value of R = %0.2f kohm\" %(R/1000)\n", "print \"Value of R1 = %0.2f kohm\" %R1\n", "print \"Value of RF = %0.2f kohm\" %(RF) " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of C = 0.01 uF\n", "Value of R = 15.92 kohm\n", "Value of R1 = 10.00 kohm\n", "Value of RF = 20.00 kohm\n" ] } ], "prompt_number": 25 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.19 : page 207" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "R=1 #in Kohm\n", "C=3.6 #in uF\n", "fo=1/(2*pi*R*1000*C*10**-6) # in Hz\n", "print \"The frequency of oscillation = %0.2f Hz\" %fo" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The frequency of oscillation = 44.21 Hz\n" ] } ], "prompt_number": 26 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.20 : page 217" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "R1=10 #in Kohm\n", "R2=47 #in Kohm\n", "R3=5.6 #in Kohm\n", "RT=4.7 #in Kohm\n", "CT=0.05 #in uF\n", "V1=-10 #in Volt\n", "V2=2 #in Volt\n", "Vop=-(R1*V1/R2+R1*V2/R3) # in volt\n", "VEE=0 #in Volt\n", "I=(VEE+3-Vop)/RT # in mA\n", "fo=0.32*I*10**-3/(CT*10**-6) #in Hz\n", "print \"Op-amp voltage = %0.2f V \"%Vop\n", "print \"Frequency = %0.2f kHz\" %(fo/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Op-amp voltage = -1.44 V \n", "Frequency = 6.05 kHz\n" ] } ], "prompt_number": 27 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.21 : page 233" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "RT=50 #in Kohm\n", "CT=0.001 #in uF\n", "V=20 #in Volt\n", "C=10 #in uF\n", "fo=0.25/(RT*10**3*CT*10**-6) #in Hz\n", "dfl=7.8*fo/V #in Hz\n", "dfc=sqrt(dfl/(2*pi*3.6*10**3*C*10**-6)) #in Hz\n", "print \"Free running frequency = %0.2f kHz\" %(fo/1000)\n", "print \"Lock range = %0.2f kHz\" %(dfl/1000)\n", "print \"Capture range = %0.2f Hz\" %(dfc)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Free running frequency = 5.00 kHz\n", "Lock range = 1.95 kHz\n", "Capture range = 92.85 Hz\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 5.22 : page 237" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import log10, ceil\n", "# given data \n", "fomax=100 # in KHz\n", "Resolution=2 #in Hz\n", "flowest=Resolution #in Hz\n", "fclk=fomax*2.2 #in KHz\n", "# formula: 2**n=fclk/flowest\n", "n=(log10(fclk*1000/flowest))/log10(2) \n", "print \" Frequency of reference oscillator = %0.2f kHz\" %fclk\n", "print \" No. of bits needed is \",ceil(n) " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Frequency of reference oscillator = 220.00 kHz\n", " No. of bits needed is 17.0\n" ] } ], "prompt_number": 29 } ], "metadata": {} } ] }