summaryrefslogtreecommitdiff
path: root/Analog_Integrated_Circuits_by_J._B._Gupta/Chaper06.ipynb
blob: 9e3c7e2ecd203c8ac98a19f88f75428e0b41d2a8 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:35cefa1a4ef186a1d32cec5eab7cbcc5a59aadb0b75b7fb4053796fe08e1ae51"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter -6 Digitally Controlled Frequency Synthesizers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 - Page 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "import math\n",
      "from fractions import Fraction \n",
      "# Given data\n",
      "R1= 15*10**3 # in \u03a9\n",
      "C1= 0.01*10**-6 # in F\n",
      "C2= 10*10**-6 # in F\n",
      "R2= 3.6*10**3 # in \u03a9\n",
      "Vpos= 12 # in V\n",
      "Vneg= -12 # in V\n",
      "f_out= 1.2/(4*R1*C1) # free running frequency in Hz\n",
      "f_out= f_out*10**-3 # in kHz\n",
      "print \"The free running frequency = %0.f kHz\" %f_out \n",
      "f_L= 8*f_out/(Vpos-(Vneg)) #Lock-range in kHz\n",
      "print \"Lock-range of the circuit = \u00b1 \", Fraction(f_L).limit_denominator(100), \"kHz\" \n",
      "f_L= f_L*10**3 # in Hz\n",
      "f_C= math.sqrt(f_L/(2*pi*R2*C2)) # Hz\n",
      "print \"Capture-range of the circuit = \u00b1 %0.2f Hz\" %f_C"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The free running frequency = 2 kHz\n",
        "Lock-range of the circuit = \u00b1  2/3 kHz\n",
        "Capture-range of the circuit = \u00b1 54.29 Hz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 - Page 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "f_out_max= 200 # in kHz\n",
      "f_lowest= 1 # in Hz\n",
      "# Frequency of reference oscillator,\n",
      "f_ref_os= 2.2*f_out_max # in kHz\n",
      "print \"The frequency of reference oscillator = %0.f kHz\" %f_ref_os\n",
      "# Formula used : f_lowest= f_ref_os/2**n\n",
      "n= round(math.log(f_ref_os*10**3/f_lowest, 10)/math.log(2,10))\n",
      "print a\n",
      "print \"The number of bits required = %0.f\" %n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of reference oscillator = 440 kHz\n",
        "19.0\n",
        "The number of bits required = 19\n"
       ]
      }
     ],
     "prompt_number": 26
    }
   ],
   "metadata": {}
  }
 ]
}