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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 06 : Digital Circuits"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.1, Page No 165"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"\n",
"R1=15.0 #in K\n",
"R2=100.0 #in K\n",
"#R1 and R2 are voltages at base which acts as potential divider\n",
"Rc=2.2 #voltage at collector in K\n",
"hfe=30.0\n",
"\n",
"\n",
"\n",
"#Calculations\n",
"#For vi=0\n",
"Vb = (R1/(R1+R2))*(-12) #Voltage at base in V\n",
"\n",
"print(\"Vb= %.2f V \" %Vb)\n",
"#A bias of 0V is required to cut off a silicon emitter junction transistor given in table\n",
"Vo = 0 #in V\n",
"print(\"Vo = %.2f V \" %Vo)\n",
"\n",
"#For vi=12\n",
"vi=12 #in V\n",
"#Few standard values for silicon transistor\n",
"Vbesat=0.8 #in V\n",
"Vcesat=0.2 #in V\n",
"\n",
"#Assumption: Q is in saturation region\n",
"Ic = (vi-Vcesat)/Rc #Collector Current\n",
"print(\"Ic=%.2f v \" %Ic)\n",
"Ibmin=(Ic/hfe) #Mininmum current at the base\n",
"print(\"Ibmin=%.2f mA\" %Ibmin)\n",
"I1=(vi-Vbesat)/R1 #Current in R1\n",
"I2=(Vbesat-(-12))/100 #Current in R2\n",
"Ib = I1-I2 #Base current\n",
"print(\"Ib = %.2f mA \" %Ib)\n",
"\n",
"#Results\n",
"if Ib>Ibmin :\n",
" print('Since Ib>Ibmin , The transistor is in saturation region and drop is Vcesat')\n",
" vo=Vcesat\n",
" print(\"vo = %.2f V \" %vo)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Vb= -1.57 V \n",
"Vo = 0.00 V \n",
"Ic=5.36 v \n",
"Ibmin=0.18 mA\n",
"Ib = 0.62 mA \n",
"Since Ib>Ibmin , The transistor is in saturation region and drop is Vcesat\n",
"vo = 0.20 V \n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.2, Page No 167"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#initialisation of variables\n",
"#Caption: To verify given equation\n",
"\n",
"print('NOTE: We will write A with a bar on its top as a ')\n",
"print('To verify')\n",
"print(' A + aB = A + B')\n",
"\n",
"print('We know that B + 1 = 1 and A1 = A')\n",
"print('A + aB = A(B+1) + aB = AB + A + aB =')\n",
"print('(A + a)B + A = B + A')\n",
"print('which is equal to RHS')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"NOTE: We will write A with a bar on its top as a \n",
"To verify\n",
" A + aB = A + B\n",
"We know that B + 1 = 1 and A1 = A\n",
"A + aB = A(B+1) + aB = AB + A + aB =\n",
"(A + a)B + A = B + A\n",
"which is equal to RHS\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.3a Page No 167"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#initialisation of variables\n",
"\n",
"R=15.0 #in K\n",
"R1=15.0 #in K\n",
"R2=100.0 #in K\n",
"R3=2.2 #in K\n",
"V0=0 #in V\n",
"V1=12.0 #in V\n",
"Vcc=12.0 #in V\n",
"\n",
"#If input is at V0=0V\n",
"Vb = -Vcc*(R1/(R1+R2)) #The base voltage of the transistor\n",
"\n",
"#Calculations\n",
"print(\"The base voltage of transistor Vb= %.2f v \" %Vb)\n",
"if Vb<0 :\n",
" print('Q is cutoff and Y is at 12V')\n",
" print('The result confirms the first three rows of truth table')\n",
"\n",
"\n",
"#If input is at V1 = 12V\n",
"#Assumption:All the diodes are reversed biased and transistor is in saturation\n",
"#If Q is in saturation\n",
"Vbe=0 #in V\n",
"Vp = V1*(R/(R+R1)) #voltage at point P in front of all diodes\n",
"print(\"All diodes are reversed biased by %.2f V \" %Vp)\n",
"Iq = (V1/(R+R1)-(V1/R2)) #The base current of Q\n",
"Ic=V1/R3 #Current in the collector junction\n",
"print(\"Ic= %.2f mA \" %Ic)\n",
"hFEmin = Ic/Iq\n",
"\n",
"#Results\n",
"print(\"hFEmin=%.2f \" %hFEmin)\n",
"print(\"When hFE > %.2f \" %hFEmin)\n",
"print('Under these condition the output is at ground and this satisfies the first three rows of truth table')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The base voltage of transistor Vb= -1.57 v \n",
"Q is cutoff and Y is at 12V\n",
"The result confirms the first three rows of truth table\n",
"All diodes are reversed biased by 6.00 V \n",
"Ic= 5.45 mA \n",
"hFEmin=19.48 \n",
"When hFE > 19.48 \n",
"Under these condition the output is at ground and this satisfies the first three rows of truth table\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.3b, Page No 167"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"\n",
"R=15.0 #in K\n",
"R1=15.0 #in K\n",
"R2=100.0 #in K\n",
"R3=2.2 #in K\n",
"V0=0 #in V\n",
"V1=12.0 #in V\n",
"Vcc=12.0 #in V\n",
"\n",
"#Calculations\n",
"#If input is at V0=0V\n",
"Vb = -Vcc*(R1/(R1+R2)) #Base Current in V\n",
"\n",
"#Finding thevenin equivallent fom P to ground\n",
"Rd = 1.0 #in K\n",
"Vd=0.7 #in v\n",
"Vr=1.0 #in K\n",
"#Thevenin Equivallent Voltage and resistance from P to ground\n",
"v = (Vcc*(Rd/(Rd+R)))+(Vd*(R/(R+Rd)))\n",
"rs = Rd*(R/(R+Rd))\n",
"#Open Circuit Voltage at base of the transistor\n",
"Vb1 = (-Vcc*((R1+rs)/(R1+R2+rs))) + (v*(R2/(R1+R2+rs)))\n",
"\n",
"#Results\n",
"print(\"Vb1 = %.2f v \" %Vb1)\n",
"\n",
"if Vb1>Vb :\n",
" print('The voltage is adequate to reverse bias Q')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Vb1 = -0.44 v \n",
"The voltage is adequate to reverse bias Q\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.3c Page No 168"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"R=15.0 #in K\n",
"R1=15.0 #in K\n",
"R2=100.0 #in K\n",
"R3=2.2 #in K\n",
"V0=0 #in V\n",
"V1=12.0 #in V\n",
"Vcc=12.0 #in V\n",
"\n",
"#Calculations\n",
"#To find wether with given conditions NANAD gate is satisfied\n",
"#Finding thevenin equivallent from P to ground\n",
"Rd = 1 #in K\n",
"Vd=0.7 #in v\n",
"Vr=1.0 #in K\n",
"v = (Vcc*(Rd/(Rd+R)))+(Vd*(R/(R+Rd)))\n",
"rs = Rd*(R/(R+Rd))\n",
"\n",
"#If the inputs are high\n",
"\n",
"Vcesat = 0.2 #in V\n",
"Vb2 = (-Vcc*(R1/(R1+R2)) + ((Vd+Vcesat)*R2/(R1+R2)))\n",
"\n",
"#Results\n",
"print(\"Vb2= %.2f V \" %Vb2)\n",
"print('It cuts off Q Y=1 ')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Vb2= -0.78 V \n",
"It cuts off Q Y=1 \n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.4 Page No 169"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#initialisation of variables\n",
"#Caption: To verify that AND-OR topology is equivallent to NAND-NAND system\n",
"\n",
"print('In digital electronics we have to come across situations where we need to use an inpout with a bar but here we will denote as')\n",
"print('X with a bar = Xb and X with two bars = Xbb')\n",
"\n",
"#Solution\n",
"print('We know that X =Xbb')\n",
"print('For AND OR logic the output of AND and simultaneously neglecting the input to following OR does not change the logic')\n",
"print('We have also neglected the output of the OR gate and at the same time have added an INVERTER so that logic is once again unaffected')\n",
"print('AN OR gate neglected at each terminal is an an AND circuit')\n",
"print('Since AND followed by an inverter is NAND ')\n",
"print('Hencee the NAND NAND is equivallent to AND OR')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"In digital electronics we have to come across situations where we need to use an inpout with a bar but here we will denote as\n",
"X with a bar = Xb and X with two bars = Xbb\n",
"We know that X =Xbb\n",
"For AND OR logic the output of AND and simultaneously neglecting the input to following OR does not change the logic\n",
"We have also neglected the output of the OR gate and at the same time have added an INVERTER so that logic is once again unaffected\n",
"AN OR gate neglected at each terminal is an an AND circuit\n",
"Since AND followed by an inverter is NAND \n",
"Hencee the NAND NAND is equivallent to AND OR\n"
]
}
],
"prompt_number": 17
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5a, Page No 179 "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"#Caption:To find hFEmin\n",
"#Given Data\n",
"#For transistor\n",
"Vbesat=0.8#Vgamma of diode in V\n",
"Vy=0.5#in V\n",
"Vcesat=0.2#in V\n",
"R = 5#in K\n",
"Rc = 2.2#in K\n",
"\n",
"#For diode\n",
"Vyd=0.6#in V\n",
"Vdrop=0.7#in V\n",
"\n",
"#Calculations\n",
"#The logic levels are Vcesato=0.2V for 0 state\n",
"Vcesato=0.2#in V\n",
"#The logic levels are Vcc=5V for 1 state\n",
"Vcc=5#in V\n",
"print('If atleast one input is in 0 state')\n",
"Vp = Vcesato + Vy#Potential at point P\n",
"print(\"Vp= %.2f V \" %Vp)\n",
"#For diodes D1 and D2 to be conducting\n",
"v = 2*Vdrop\n",
"print('For diodes D1 and D2 to be conducting')\n",
"print(\"required voltage = %.2f V \" %v)\n",
"#These diodes cutoff\n",
"Vbe = 0\n",
"if Vbe<Vy :\n",
" print('Q is OFF')\n",
" print('Output rises to 5V and Y = 1')\n",
" print('This confirms first 3 rows of NAND truth table')\n",
"#if all inputs are at V(1)=5V , we shall assume all input diodes OFF and D1 and D2 conduct and Q is in saturation\n",
"print('When inputs are at 5V')\n",
"Vp = Vdrop + Vdrop + Vbesat\n",
"print('V',Vp,'Vp=')\n",
"print(\"Vp= %.2f V \" %Vp)\n",
"print(\"The voltage across all input diode = %.2f v \" %(Vcc-Vp))\n",
"#For finding hFEmin\n",
"I1 = (Vcc-Vp)/R\n",
"I2 = Vbesat/R\n",
"Ib = I1-I2\n",
"Ic = (Vcc-Vcesat)/Rc\n",
"hFEmin = Ic/Ib\n",
"\n",
"#Results\n",
"print(\"hFEmin= %.2f \" %hFEmin)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"If atleast one input is in 0 state\n",
"Vp= 0.70 V \n",
"For diodes D1 and D2 to be conducting\n",
"required voltage = 1.40 V \n",
"Q is OFF\n",
"Output rises to 5V and Y = 1\n",
"This confirms first 3 rows of NAND truth table\n",
"When inputs are at 5V\n",
"('V', 2.2, 'Vp=')\n",
"Vp= 2.20 V \n",
"The voltage across all input diode = 2.80 v \n",
"hFEmin= 5.45 \n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5b Page No 179"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"#initialisation of variables\n",
"#Caption:When atleast one input is at V(0) in NAND gate\n",
"#Given Data\n",
"#For transistor\n",
"Vbesat=0.8#in V\n",
"Vy=0.5#in V\n",
"Vcesat=0.2#in V\n",
"R = 5#in K\n",
"Rc = 2.2#in K\n",
"\n",
"\n",
"#Calculations\n",
"#For diode\n",
"Vyd=0.6#Vgamma in V\n",
"Vdrop=0.7#in V\n",
"\n",
"#The logic levels are Vcesato=0.2V for 0 state\n",
"Vcesato=0.2#in V\n",
"\n",
"print('If atleast one input is in 0 state')\n",
"Vp = Vcesato + Vdrop #Voltage at point P\n",
"print(\"Vp= %.2f v \" %Vp)\n",
"Vbe = Vp-Vyd#Voltage at base emitter\n",
"\n",
"#Results\n",
"print(\"Vbe = %.2f v \" %Vbe)\n",
"if Vbe<Vy :\n",
" print('Q is cutoff')\n",
"\n",
"if Vbe>Vy :\n",
" print('Q is ON')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"If atleast one input is in 0 state\n",
"Vp= 0.90 v \n",
"Vbe = 0.30 v \n",
"Q is cutoff\n"
]
}
],
"prompt_number": 19
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5c Page No 179"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"\n",
"Vbesat=0.8#in V\n",
"Vy=0.5#in V\n",
"R = 5#in K\n",
"Rc = 2.2#in K\n",
"\n",
"#Calculations\n",
"#For diode\n",
"Vyd=0.6#in V\n",
"Vdrop=0.7#in V\n",
"\n",
"#Calculations\n",
"#The logic levels are Vcesato=0.2V for 0 state\n",
"Vcesato=0.2#in V\n",
"Vp = Vdrop + Vdrop + Vbesat#Voltage at point P\n",
"\n",
"#Results\n",
"print(\"Vp= %.2f v \" %Vp)\n",
"print(\"Each diode is reversed biased by %.2f v \" %(Vcc-Vp))\n",
"print(\"A diode starts to conduct when it is forward bias by %.2f v \" %Vyd)\n",
"vn = (Vcc-Vp) + Vyd #Noise Spike which will cause the malfunction\n",
"print(\"A noise spike which will cause malfunction is %.2f v \" %vn)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Vp= 2.20 v \n",
"Each diode is reversed biased by 2.80 v \n",
"A diode starts to conduct when it is forward bias by 0.60 v \n",
"A noise spike which will cause malfunction is 3.40 v \n"
]
}
],
"prompt_number": 20
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5d Page No 180"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#initialisation of variables\n",
"\n",
"#For transistor\n",
"Vbesat=0.8#in V\n",
"Vy=0.5#in V\n",
"R = 5#in K\n",
"Rc = 2.2#in K\n",
"\n",
"#The logic levels are Vcesato=0.2V for 0 state\n",
"Vcesato=0.2#in V\n",
"#For diode\n",
"\n",
"#Calculations\n",
"Vyd=0.6#in V\n",
"Vdrop=0.7#in V\n",
"\n",
"Vp = Vcesato + Vdrop#Voltage at point P\n",
"print(\"Vp= %.2f v \" %Vp)\n",
"Vbe = Vy#Voltage at base emitter will be same as Vgamma\n",
"vp = Vbe + Vyd +Vyd#The level to which vp should increase\n",
"Vn = vp - Vp#Noise Margin\n",
"\n",
"#Results\n",
"print(\"Noise Margin = %.2f v \" %Vn)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Vp= 0.90 v \n",
"Noise Margin = 0.80 v \n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.6, Page No 92"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#initialisation of variables\n",
"\n",
"hFE=30\n",
"Vbe1active=0.7#in V\n",
"Vd2=0.7#in V\n",
"Vbe2sat=0.8#in V\n",
"Vcc=5#in V\n",
"R1=1.75#in K\n",
"R2=2#in K\n",
"R3=2.2#in K\n",
"R4=5#in K\n",
"\n",
"\n",
"#Calculations\n",
"Vp = Vbe1active + Vd2 + Vbe2sat#Voltage at point P\n",
"#The current in 2K resistor is Ib1\n",
"#In active region\n",
"#Ic1=hFE*Ib1\n",
"#I1 = Ib1+Ic1=(1+hFE)*Ib1.... Now applying KVL between Vcc and Vp\n",
"#Vcc-Vp = R1*(1+hFE)*Ib1 + 2*Ib1\n",
"Ib1 = (Vcc-Vp)/(R1*(1+hFE)+2)#Base current in transistor 1\n",
"print(\"Ib1= %.2f mA \" %Ib1)\n",
"Ic1=hFE*Ib1#Collector Current in transistor 1\n",
"print(\"Ic1= %.2f mA \" %Ic1)\n",
"I1 = Ib1 + Ic1#in mA\n",
"I2=Vbe2sat/R4#in mA\n",
"Ib2 = I1-I2#Base Current in Transistor 2\n",
"#The unloaded current of Q2\n",
"Iq2=(Vcc-0.2)/R3\n",
"#For each gate which it drive ,Q2 must sink a standard load of\n",
"I=(Vcc-Vd2-0.2)/(R1+R2)\n",
"#To Calculate the FAN OUT\n",
"#The maximum current is hFE*Ib2\n",
"#hFE*Ib2 = (I*N) + Iq2\n",
"N=((hFE*Ib2)-Iq2)/I#FAN OUT\n",
"\n",
"#Results\n",
"print(\"N = %.2f v \" %N)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Ib1= 0.05 mA \n",
"Ic1= 1.49 mA \n",
"N = 35.96 v \n"
]
}
],
"prompt_number": 22
}
],
"metadata": {}
}
]
}
|