{
 "metadata": {
  "name": "",
  "signature": "sha256:8031d2b3be7285338d4c75ced4c49e8240652de917ff83e30f4a9fa6859d2b74"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 17 Data acquisition system"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17.1 Page no 640"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "n=5                     #bit\n",
      "a=10\n",
      "b=20\n",
      "c=30\n",
      "\n",
      "#Calculation\n",
      "Wlsb=-(1/2.0**n-1)\n",
      "Wlsb2=(2/2.0**n)\n",
      "Wlsb3=(4/2.0**n)\n",
      "V1=a/(2.0**n-1)\n",
      "V2=b/(2.0**n-1)\n",
      "V3=c/(2.0**n-1)\n",
      "Va=(a*2**4+a*2**3+0*2**2+a*2**1+a*2**0)/(2.0**5-1)\n",
      "Vb=(a*2**4+0*2**3+a*2**2+a*2**1+0*2**0)/(2.0**5-1)\n",
      "#Result\n",
      "print\"(1) The LSB Weight is \", round(Wlsb,2)\n",
      "print\"(2) The 2nd LSB Weight is \", round(Wlsb2,2),\"And 2rd LSB weight is \",Wlsb3\n",
      "print\"(3) Ist LSB causes a change in output voltage is \", round(V1,1)\n",
      "print\"    2nd LSB causes a change in output voltage is \", round(V2,1)\n",
      "print\"    3rdLSB causes a change in output voltage is \", round(V1,1)\n",
      "print\"(4) Output voltage for 11011 is \" ,round(Va,2),\"Volt\"\n",
      "print\"    Output voltage for 10110 is \" ,round(Vb,2),\"Volt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1) The LSB Weight is  0.97\n",
        "(2) The 2nd LSB Weight is  0.06 And 2rd LSB weight is  0.125\n",
        "(3) Ist LSB causes a change in output voltage is  0.3\n",
        "    2nd LSB causes a change in output voltage is  0.6\n",
        "    3rdLSB causes a change in output voltage is  0.3\n",
        "(4) Output voltage for 11011 is  8.71 Volt\n",
        "    Output voltage for 10110 is  7.1 Volt\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}