{
 "metadata": {
  "name": "",
  "signature": "sha256:448fe7630f3affc67a26ee31d0d2cd681158ac6be6a5f6e0cd51550e7fad58b6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 21 - Integrated Circits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 1067"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_1 Pg-1067\n",
      "#calculate Pulse width\n",
      "print'%s'%(\"Refer to figure 21.10\")\n",
      "R=5000. #resistor R in ohm\n",
      "C=0.1*10.**(-6.) #capacitance in farad\n",
      "tau=1.1 #time constant\n",
      "tON=tau*R*C #pulse width in sec\n",
      "print'%s %.2f'%(\"Pulse width = msec\",tON*1e3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to figure 21.10\n",
        "Pulse width = msec 0.55\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 1068"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_2 Pg-1068\n",
      "#calculate time output\n",
      "print '%s' %(\"Refer to figure 21.12\")\n",
      "R1=20000. #timing resistor R1 in ohm\n",
      "R2=R1 #timing resistor R2 in ohm\n",
      "C=0.1*10.**(-6.) #capacitance in farad\n",
      "tau=0.69 #time constant\n",
      "tHIGH=tau*(R1+R2)*C #time output that will remain high\n",
      "print '%s %.2f' %(\"Time output = msec\",tHIGH*1e3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to figure 21.12\n",
        "Time output = msec 2.76\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 1069"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_3 Pg-1069\n",
      "#calculate time output\n",
      "print '%s' %(\"Refer to figure 21.12\")\n",
      "R2=20000. #timing resistor R2 in ohm\n",
      "C=0.1*10.**(-6.) #capacitance in farad\n",
      "tau=0.69 #time constant\n",
      "tLOW=tau*(R2)*C #time output that will remain high\n",
      "print '%s %.2f' %(\"Time output = msec\",tLOW*1e3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to figure 21.12\n",
        "Time output = msec 1.38\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 1069"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_4 Pg-1069\n",
      "#calculate output frequency\n",
      "R1=20000. #timing resistor R1 in ohm\n",
      "R2=R1 #timing resistor R2 in ohm\n",
      "C=0.1*10.**(-6.) #capacitance in farad\n",
      "f0=1.45/((R1+2.*R2)*C) #output frequency\n",
      "print '%s %.2f' %(\"Output frequency = Hz\",f0)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output frequency = Hz 241.67\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 1069"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_5 Pg-1069\n",
      "#calculate duty cycle\n",
      "print '%s' %(\"Refer to figure 21.12\")\n",
      "R1=20000. #timing resistor R1 in ohm\n",
      "R2=R1 #timing resistor R2 in ohm\n",
      "D=(R1+R2)/(R1+2.*R2)*100. #duty cylce\n",
      "print '%s %.1f' %(\"Duty cycle =\",D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refer to figure 21.12\n",
        "Duty cycle = 66.7\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 1070"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_6 Pg-1070\n",
      "#calculate R1 and R2\n",
      "C=0.01*10.**(-6.) #capacitance in farad\n",
      "f0=2000. #frequency in Hz\n",
      "Req=1.45/(f0*C) #equivalent resistance or R1+R2\n",
      "print '%s' %(\"Because a square wave has duty cycle of 50% each resistor must be the same\")\n",
      "R1=Req/2. \n",
      "R2=R1\n",
      "print'%s %.2f' %(\"R1 = R2 = kohm\",R2*1e-3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Because a square wave has duty cycle of 50% each resistor must be the same\n",
        "R1 = R2 = kohm 36.25\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 1073"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_7 Pg-1073\n",
      "#calculate pulse width\n",
      "R=260000. #resistor R in ohm\n",
      "C=25*10.**(-6.) #capacitance in farad\n",
      "tau=1.1 #time constant\n",
      "t_delay=tau*R*C #pulse width in sec\n",
      "print '%s %.2f' %(\"Pulse width = sec\",t_delay)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pulse width = sec 7.15\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 1076"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex21_8 Pg-1076\n",
      "#calculate Binary value of 253\n",
      "dec=253 #decimal number\n",
      "bina=bin(dec) #binary value of 253\n",
      "print bina"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0b11111101\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}