summaryrefslogtreecommitdiff
path: root/Integrated_Circuits/Chapter6.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Integrated_Circuits/Chapter6.ipynb')
-rwxr-xr-xIntegrated_Circuits/Chapter6.ipynb354
1 files changed, 354 insertions, 0 deletions
diff --git a/Integrated_Circuits/Chapter6.ipynb b/Integrated_Circuits/Chapter6.ipynb
new file mode 100755
index 00000000..ab519b33
--- /dev/null
+++ b/Integrated_Circuits/Chapter6.ipynb
@@ -0,0 +1,354 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8a254c33be18374a78b4f00ca9688168896a7d9ddc01623f880056b5f9ba95d9"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter6: A/D, D/A Converters"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:pg-311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Ex 6.1 \n",
+ "n=8 #no. of bits\n",
+ "V1=0 #V\n",
+ "V2=5.12 #V\n",
+ "Res=2**n #resolution\n",
+ "print Res,\" =(a) Resolution\" \n",
+ "delVo=(V2-V1)/Res*1000 #mV/bit\n",
+ "print int(delVo),\" =(b) Output change per bit(mV/bit) \" \n",
+ "VFS=V2*(1-1/2**n) #V\n",
+ "print round(VFS,1),\" =(c) Full scale Output voltage(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "256 =(a) Resolution\n",
+ "20 =(b) Output change per bit(mV/bit) \n",
+ "5.1 =(c) Full scale Output voltage(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:pg-312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Ex 6.2\n",
+ "import math\n",
+ "step=10.3 #mV\n",
+ "reading='101101111' #reading\n",
+ "Vo=step*int(reading,2)/1000 #V\n",
+ "print round(Vo,2),\" = Output voltage(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.78 = Output voltage(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:pg-312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.3\n",
+ "n=8.0 #no. of bits\n",
+ "V=10 #volts\n",
+ "LSB=V*1/2**n #V\n",
+ "MSB=V*1/2**0 #V \n",
+ "VFS=MSB-LSB #V\n",
+ "print int(LSB*1000),\" = LSB(mV) \" \n",
+ "print MSB,\" = MSB(V) \" \n",
+ "print round(VFS,3),\" = VFS(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "39 = LSB(mV) \n",
+ "10 = MSB(V) \n",
+ "9.961 = VFS(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:pg-312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.4\n",
+ "import math\n",
+ " #(i)2-bit DAC\n",
+ "n=2.0 #no. of bits\n",
+ "V=10.0 #max Voltage\n",
+ "step=V/2**n #V\n",
+ "reading='10' #input in binary\n",
+ "Vo=step*int(reading,2) #V\n",
+ "print Vo,\" =(i) Output Voltage(V) \" \n",
+ " #(ii)4-bit DAC\n",
+ "n=4.0 #no. of bits\n",
+ "step=V/2**n #V\n",
+ "reading='0110' #input in binary\n",
+ "Vo=step*int(reading,2) #V\n",
+ "print Vo,\" =(ii) Output Voltage(V) \" \n",
+ " #(i)8-bit DAC\n",
+ "n=8.0 #no. of bits\n",
+ "step=V/2**n #V\n",
+ "reading='10111100' #input in binary\n",
+ "Vo=step*int(reading,2) #V\n",
+ "print round(Vo,2),\" =(iii) Output Voltage(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5.0 =(i) Output Voltage(V) \n",
+ "3.75 =(ii) Output Voltage(V) \n",
+ "7.34 =(iii) Output Voltage(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:pg-313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.5\n",
+ "import math\n",
+ "n=8.0 #no. of bits\n",
+ "Res=20.0 #mV/bit(Resolution)\n",
+ "reading='00010110' #input in binary\n",
+ "Vo=Res*int(reading,2) #V\n",
+ "print Vo/1000,\" =(a) Output Voltage(V) \" \n",
+ "reading='10000000' #input in binary\n",
+ "Vo=Res*int(reading,2) #V\n",
+ "print Vo/1000,\" =(b) Output Voltage(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.44 =(a) Output Voltage(V) \n",
+ "2.56 =(b) Output Voltage(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:pg-313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.6 \n",
+ "n=12 #no. of bits\n",
+ "Eoff=0.05 #% #maximum offset error\n",
+ "Vref=10.24 #V\n",
+ "Voffset=Eoff/100*Vref #V\n",
+ "print int(Voffset*1000),\" =(a) Offset voltage(mV) \" \n",
+ "delVo=Vref/2**n #V/bit\n",
+ "Voff_dash=Voffset/delVo #in terms of LSB\n",
+ "print int(Voff_dash),\" =(b) Offset voltage in terms of LSB \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5 =(a) Offset voltage(mV) \n",
+ "2 =(b) Offset voltage in terms of LSB \n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:pg-313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.7 \n",
+ "n=8 #no. of bits\n",
+ "E=0.2 #% #maximum gain error\n",
+ "Vref=5.1 #V\n",
+ "V11=(100-E)*Vref/100 #V\n",
+ "print V11,\" =Minimum output voltage(V) \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5.0898 =Minimum output voltage(V) \n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.8:pg-326"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.8\n",
+ "n=8.0 #no. of bits\n",
+ "V=10.0 #V maximum\n",
+ "Vin=5.2 #V\n",
+ "oneLSB=V/2**n #V\n",
+ "print round(oneLSB*1000,1),\" =(a) Minimum voltage for 1 LSB in mV \" \n",
+ "Vifs=round(V-oneLSB,3) #V\n",
+ "\n",
+ "print Vifs,\" =(b) For all ones input voltage should be (V) \" \n",
+ "D=Vin/oneLSB #Digital output in decimal \n",
+ "print int(D),\" =(c) Digital Output \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "39.1 =(a) Minimum voltage for 1 LSB in mV \n",
+ "9.961 =(b) For all ones input voltage should be (V) \n",
+ "133 =(c) Digital Output \n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:pg-326"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #Ex 6.9\n",
+ "n=8 #no. of bits\n",
+ "f=1 #MHz(Clock frequency) \n",
+ "TC=1/f*(n+1) #seconds\n",
+ "print TC,\" = time in micro seconds \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9 = time in micro seconds \n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file