{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 6: data converters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.10: Find_input_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find input voltage\n", "//Ex6.10\n", "clc\n", "clear\n", "close\n", "Vref=5//reference voltage(in V)\n", "t1=0.2//coumts when input voltage is applied(in sec)\n", "R=100*10^3//resistance(in ohm)\n", "C=10^-6//capacitance(in F)\n", "t2=R*C\n", "Vin=(t2/t1)*Vref\n", "disp(Vin,'input voltage(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.11: Find_a_output_voltage_after_1_sec_b_fall_time_of_reference_voltage_waveform.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find(a)output voltage after 1 sec(b)fall time of reference voltage waveform\n", "//Ex6.11\n", "clc\n", "clear\n", "close\n", "R=100000//resistance of DVM(in ohm)\n", "C=10^-6//capacitance(in F)\n", "Vin=1//input voltage(in V)\n", "t1=1//rise time of reference voltage waveform at output of integrator(in second)\n", "Vref=5//reference voltage(in V)\n", "Vo=Vin*(t1/(R*C))\n", "disp(Vo,'(a)output voltage after 1sec(in V)=')\n", "t2=(Vin/Vref)*t1\n", "disp(t2,'(b)fall time reference voltage waveform(in second)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.1: Find_output_voltage_for_a_binary_input_a_1111_b_1100.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find output voltage for a binary input(a)1111(b)1100\n", "//Ex6.1\n", "clc\n", "clear\n", "close\n", "N=4//bit of D/A convertor\n", "Rlsb=16//resistance at LSB position(in kilo ohm)\n", "Vref=5//reference voltage(in V)\n", "Ro=1//feedback resistance(in kilo ohm)\n", "R=Rlsb/(2^(N-1))\n", "Va=-(Ro/R)*Vref*(2^0*1+2^-1*1+2^-2*1+2^-3*1)\n", "disp(Va,'(a)output voltage(in V)=')\n", "Vb=-(Ro/R)*Vref*(2^0*1+2^-1*1+2^-2*0+2^-3*0)\n", "disp(Vb,'(b)output voltage(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.2: Find_output_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find output voltage\n", "//Ex6.2\n", "clc\n", "clear\n", "close\n", "Lo=0//input voltage logic0(in V)\n", "L1=20//input voltage logic1(in V)\n", "V1msb=L1/2\n", "V2msb=L1/4\n", "V3msb=L1/8\n", "V4msb=L1/16\n", "Va=V1msb+V2msb+V3msb+V4msb\n", "disp(Va,'output voltage(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.3: Find_output_voltage_if_input_is_101101111.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find output voltage if input is 101101111\n", "//Ex6.3\n", "clc\n", "clear\n", "close\n", "V=10.3*10^-3//input voltage of DAC convertor(in V)\n", "Vo=(V)*(1*2^8+0*2^7+1*2^6+1*2^5+0*2^4+1*2^3+1*2^2+1*2^1+1*2^0)\n", "disp(Vo,'output voltage(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.4: Find_values_of_a_LSB_b_MSB_c_full_scale_output.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find values of(a)LSB(b)MSB(c)full scale output\n", "//Ex6.4\n", "clc\n", "clear\n", "close\n", "N=8//bit of the DAC convertor\n", "Rmin=0//minimum range(in V)\n", "Rmax=10//maximum range(in V)\n", "LS=1/(2^N)\n", "LSB=Rmax*LS\n", "disp(LSB,'(a)LSB(in V)=')\n", "MSB=Rmax/2\n", "disp(MSB,'(b)MSB(in V)=')\n", "F=Rmax-LSB\n", "disp(F,'(c)full scale output(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.5: Find_resolution_and_voltage.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find resolution and voltage\n", "//Ex6.5\n", "clc\n", "clear\n", "close\n", "N=3//bit of D/A convertor\n", "V=5//full scale voltage(in V)\n", "A=0.001//magnitude of accuracy\n", "R=1/2^N\n", "disp(R,'resolution(in V)=')\n", "Ac=A*V\n", "disp(Ac,'accuracy(in V)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.6: Find_conversion_time_required_for_invertor.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find conversion time required for cinvertor\n", "//Ex6.6\n", "clc\n", "clear\n", "close\n", "N=8//bit of A/D convertor\n", "Vr=2.56//clock voltage(in V)\n", "Vin=1.728//input voltage(in V)\n", "F=100*10^3//clock frequency(in Hz)\n", "P=173//steps required for conversion\n", "Po=1/F\n", "T=P*Po\n", "disp(T,'total conversion time(in second)=')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.9: Find_total_number_of_pulses_and_display_reading.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//caption:Find total number of pulses and display reading\n", "//Ex6.9\n", "clc\n", "clear\n", "close\n", "V=10//input voltage(in V)\n", "S=0.001//ramp slope(in V/second)\n", "F=1000000//clock frequency(in Hz)\n", "T=1/F\n", "t=V*S\n", "P=t/T\n", "disp(P,'total number of pulses=')\n", "disp(P,'display reading=')" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }