{

 "metadata": {

  "name": "",

  "signature": "sha256:841a88d7e9e844c5ea929c5620ee175fbc10b920d638293263fe8c73afe043c7"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter7: Integrated Circuit Timer And Phase Locked Loops (PLL) "

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.1:pg-339"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 7.1\n",

      "RA=6.8  #kohm\n",

      "RB=3.3  #kohm\n",

      "C=0.1  #micro F\n",

      "VCC=5  #V\n",

      "t_high=0.695*(RA+RB)*C  #ms\n",

      "print round(t_high,1),\" =(a) t_high(ms)  \" \n",

      "t_low=0.695*RB*C  #ms\n",

      "print round(t_low,2),\" =(b) t_low(ms)  \" \n",

      "f=1.44/(RA+2*RB)/(C)  #kHz\n",

      "print round(f,2),\" =(c) Frequency of oscillation(kHz)  \" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.7  =(a) t_high(ms)  \n",

        "0.23  =(b) t_low(ms)  \n",

        "1.07  =(c) Frequency of oscillation(kHz)  \n"

       ]

      }

     ],

     "prompt_number": 20

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.2:pg-339"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 7.2\n",

      "RA=10  #kohm\n",

      "C=0.1  #micro F\n",

      "t=1.1*RA*C  #ms\n",

      "print t,\"= Timing interval(ms)  \" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "1.1 = Timing interval(ms)  \n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.3:pg-352"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 7.3 \n",

      "fc=500  #kHz(Free running frequuency)\n",

      "fi=600  #kHz(Input signal frequuency)\n",

      "BW=10  #kHz\n",

      "out1=fi+fc  #kHz(Phase detector output)\n",

      "out2=fi-fc  #kHz(Phase detector output)\n",

      "print out2,out1,\"= Output of phase detector will be(kHz)  \" \n",

      "print \"Both components are not lying in the passband(i.e. 10 kHz). Hence loop will not acquire lock.  \" \n",

      " #fi+fc is calculated wrong in the book.\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "100 1100 = Output of phase detector will be(kHz)  \n",

        "Both components are not lying in the passband(i.e. 10 kHz). Hence loop will not acquire lock.  \n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.4:pg-352"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 7.4\n",

      "import math \n",

      "fo=10.0  #kHz\n",

      "V=12.0  #V\n",

      "fL=round(8*fo/(V-(-V)),2)  #kHz(both +ve & -ve value)\n",

      "C=10  #micro F(Assumed)\n",

      "fC=round(math.sqrt(fL*10**3/(2*math.pi*3.6*10**3*C*10**-6)),2)  #Fz(both +ve & -ve value)\n",

      "print fC,fL,\"= Frequency fL & fC in kHz  \" \n",

      "LR=2*fL  #kHz(Lock Range)\n",

      "print round(LR,1),\"= Lock Range(kHz)  \" \n",

      "CR=2*fC  #kHz(Capture rage)\n",

      "print round(CR,1),\"= Capture Range(Hz)  \" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "121.33 3.33 = Frequency fL & fC in kHz  \n",

        "6.7 = Lock Range(kHz)  \n",

        "242.7 = Capture Range(Hz)  \n"

       ]

      }

     ],

     "prompt_number": 28

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.5:pg-353"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 7.5\n",

      "import math\n",

      " \n",

      "fo=100.0  #kHz(Free running frequency)\n",

      "V=6.0  #V(both +ve & -ve value)\n",

      "C=1  #micro F(Demodulation capacitor)\n",

      "fL=round(8*fo/(V-(-V)),3) #Hz(both +ve & -ve value)\n",

      "fC=math.sqrt(fL*1000/(2*math.pi*3.6*10**3*C*10**-6))  #kHzz(both +ve & -ve value)\n",

      "LR=round(2*fL,2)  #kHz(Lock range)\n",

      "print LR,\"= Lock Range(kHz)\" \n",

      "CR=round(2*fC/1000,2)  #kHz(Capture range)\n",

      "print CR,\"= Capture Range(kHz)  \" \n",

      "RT=10  #kohm(Assumed)\n",

      "CT=1.2/(4*RT*1000*fo*10**3)  #F\n",

      "print \"Design values are:\" \n",

      "print \"Resistance RT can be chooosen as 10 kohm.  \"  \n",

      "print CT,\" =Capacitance CT(F)  \" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "133.33 = Lock Range(kHz)\n",

        "3.43 = Capture Range(kHz)  \n",

        "Design values are:\n",

        "Resistance RT can be chooosen as 10 kohm.  \n",

        "3e-10  =Capacitance CT(F)  \n"

       ]

      }

     ],

     "prompt_number": 39

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.7:pg-355"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      " #Ex 7.7\n",

      "import math\n",

      "C=1  #nF\n",

      "T=10  #micro seconds(Output pulse duration)\n",

      "R=round(T*10**-6/(C*10**-9*math.log(3))/1000,1)  #kohm\n",

      "print R,\" =(a) Value of R(kohm)  \" \n",

      "VCC=15  #V\n",

      "T=20  #micro seconds(Output pulse duration)\n",

      "VTH=VCC*(1-exp(-T*10**-6/(R*1000*C*10**-9)))  #V\n",

      "print round(VTH,1),\" =(b) Value of VTH(V)  \" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "9.1  =(a) Value of R(kohm)  \n",

        "13.3  =(b) Value of VTH(V)  \n"

       ]

      }

     ],

     "prompt_number": 41

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex7.8:pg-355"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      " #Ex 7.8\n",

      "import math\n",

      "C=680.0  #pF\n",

      "f=50.0  #kHz(Square wave frequency)\n",

      "D=75.0/100.0  #duty cycle\n",

      "T=1/f*1000  #micro seconds\n",

      "tHIGH=D*T  #micro seconds\n",

      "print tHIGH,\" = Value of tHIGH  \"\n",

      "tLOW=T-tHIGH  #micro seconds\n",

      "print tLOW,\" = Value of tLOW  \" \n",

      "RB=(tLOW*10**-6)/(0.69*C*10**-12)  #ohm\n",

      "RA=(tHIGH*10**-6)/(0.695*C*10**-12)-RB  #ohm\n",

      "print round(RA/1000,1),\" = Value of RA(kohm)  \" \n",

      "print round(RB/1000,2),\" = Value of RB(kohm)  \" \n",

      "# Answer in the book is wrong for RA i.e. 21.2"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "15.0  = Value of tHIGH  \n",

        "5.0  = Value of tLOW  \n",

        "21.1  = Value of RA(kohm)  \n",

        "10.66  = Value of RB(kohm)  \n"

       ]

      }

     ],

     "prompt_number": 62

    }

   ],

   "metadata": {}

  }

 ]

}