summaryrefslogtreecommitdiff
path: root/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter10.ipynb
blob: 9fe9f6c7d39d4876efd36a32091baa885d142208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
{
 "metadata": {
  "name": "",
  "signature": "sha256:f64bf7a670dc36e359e5aa56e0bfa29f09c70f7a0babc95be4c64434f164d9d6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10 - Comparators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 10.1 - page : 334"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import pi, sin\n",
      "t=range(0,5) #sec(Assumed)\n",
      "Vin=5*sin(2*pi*t[0]) #V\n",
      "VCC=15 #V\n",
      "R2=1 #kohm\n",
      "R1=6.8 #kohm\n",
      "VEE=-15 #V\n",
      "Vsat=13 #V\n",
      "Vref=R2*VCC/(R1+R2) #V\n",
      "print \"Reference Voltage = %0.2f V \" %Vref\n",
      "print \"If Vin>Vref , Vout = %0.2f V \" %Vsat \n",
      "print \"If Vin<Vref , Vout = %0.2f V \" %-Vsat"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reference Voltage = 1.92 V \n",
        "If Vin>Vref , Vout = 13.00 V \n",
        "If Vin<Vref , Vout = -13.00 V \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 10.2 - page 340"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vsat=7 #V\n",
      "R1=68 #kohm\n",
      "R2=82 #kohm\n",
      "VUTP=R2*Vsat/(R1+R2) #V\n",
      "VLTP=R2*-Vsat/(R1+R2) #V\n",
      "print \"Upper trip point = %0.2f V \" %VUTP \n",
      "print \"Lower trip point = %0.2f V \" %VLTP"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Upper trip point = 3.83 V \n",
        "Lower trip point = -3.83 V \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 10.3 - page : 340"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import arcsin, pi\n",
      "#Vin=5*sin(omega*t)\n",
      "Vm=5 #V\n",
      "Vsat=7 #V\n",
      "R1=68 #kohm\n",
      "R2=82 #kohm\n",
      "VUTP=R2*Vsat/(R1+R2) #V\n",
      "fi=arcsin(VUTP/Vm)*180/pi #degree\n",
      "print \"Phase shift = %0.2f degree \" %fi \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Phase shift = 49.94 degree \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 10.4 - page : 344"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "VZ1=4.7 #V\n",
      "VZ2=4.7 #V\n",
      "R1=68 #kohm\n",
      "R2=15 #kohm\n",
      "Vout=VZ1+0.7 #V(As one zener diode is always forward biased)\n",
      "VR1=Vout #V\n",
      "IR1=VR1/R1*1000 #micro A\n",
      "IR2=IR1 #micro A\n",
      "VR2=IR2*10**-3*R2 #V\n",
      "Vout=VR1+VR2 #V\n",
      "VUTP=(R2/(R1+R2))*Vout #V\n",
      "VLTP=(R2/(R1+R2))*(-Vout) #V\n",
      "print \"VUTP = %0.2f V \" %VUTP \n",
      "print \"VLTP = %0.2f V \" %VLTP"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "VUTP = 1.19 V \n",
        "VLTP = -1.19 V \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 10.5 - page : 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vsat=12.5 #V\n",
      "Vref=-12.5 #V\n",
      "R1=80 #kohm\n",
      "R2=20 #kohm\n",
      "Beta=R2/(R1+R2) #unitless\n",
      "UTP=Beta*Vsat+(1-Beta)*Vref #V\n",
      "LTP=-Beta*Vsat+(1-Beta)*Vref #V\n",
      "VH=UTP-LTP #V\n",
      "R3=R1*R2/(R1+R2) #kohm\n",
      "print \"UTP = %0.2f V \" %UTP \n",
      "print \"LTP = %0.2f V \" %LTP \n",
      "print \"Hysteresis Voltage, VH = %0.2f V \" %VH \n",
      "print \"Use R3 = %0.2f kohm \" %R3 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "UTP = -7.50 V \n",
        "LTP = -12.50 V \n",
        "Hysteresis Voltage, VH = 5.00 V \n",
        "Use R3 = 16.00 kohm \n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}