{
 "metadata": {
  "name": "",
  "signature": "sha256:89c00d18387baa8ff8cb1569e29bf4fd2a1dcb717ea9b58f880f8e28f32b148c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 - Integrated Circuit Logic Gates"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption: Determine fan out for DTL NAND gate \n",
      "hfe=19.1\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "R3=6.#Resistance(in kilo ohm)\n",
      "R2=5.#Resistance(in kilo ohm)\n",
      "Vcc=5.#Supply voltage(in volts)\n",
      "R1=2.#Resistance(in kilo ohm)\n",
      "Vce=0.2#Collector emitter voltage(in volts)\n",
      "Vf4=0.7#Diode forward voltage\n",
      "Vf5=Vf4\n",
      "Vf6=Vf4\n",
      "I2=Vbe/R2\n",
      "Va=Vf4+Vf5+Vbe\n",
      "I1=(Vcc-Va)/R1\n",
      "Ib=I1-I2\n",
      "Ic1=hfe*Ib\n",
      "I3=(Vcc-Vce)/R3\n",
      "Iol=Ic1-I3\n",
      "R4=R1\n",
      "Iil=(Vcc-Vf6)/R4\n",
      "fo=Iol/Iil\n",
      "print '%s %.f' %('Fan out=',fo)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fan out= 11\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 381"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine Resistance to drive inputs of 5 TTL gates\n",
      "Ii=1.6#Maximum input current(in mA)\n",
      "Io=16.#Maximum output current(in mA)\n",
      "Vcc=5.#Supply voltage(in volts)\n",
      "Vo=0.4#Maximum output voltage(in volts)\n",
      "Il=5.*Ii\n",
      "Irc=Io-Il\n",
      "Vrc=(Vcc-Vo)\n",
      "Rc=Vrc*1000./Irc\n",
      "print '%s %.f' %('Required resistance(in ohm)=',Rc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required resistance(in ohm)= 575\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 403"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a interface circuit for CMOS\n",
      "Vdd=15.#Drain voltage(in volts)\n",
      "Rd=1.#Drain resistance(in kilo ohm)\n",
      "Vcc=5.#Supply voltage(in volts)\n",
      "Ih=40.#Current(in micro ampere)\n",
      "hfe=20.\n",
      "Vce=0.2#Saturated collector emitter voltage(in volts)\n",
      "vih=2.#High input voltage(in volts)\n",
      "il=1.6#Low input current\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Rc=(Vcc-vih)*1000./(2.*Ih)\n",
      "Ic=((Vcc-Vce)/Rc)+(2.*il)\n",
      "Ib=Ic/hfe\n",
      "R=(Vdd-Vbe)/Ib\n",
      "Rb=R-Rd\n",
      "print '%s %.1f %s %.1f' %('Components required to design circuit are resistors \\nRb(in kilo ohm)=',Rb,'\\nRc(in kilo ohm)=',Rc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Components required to design circuit are resistors \n",
        "Rb(in kilo ohm)= 84.9 \n",
        "Rc(in kilo ohm)= 37.5\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}