csl f interfacing

Upload: max-cheah

Post on 13-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 CSL F Interfacing

    1/52

    INTERF CINGWITHTHE

    N LOGUEWORLD

    1

  • 7/24/2019 CSL F Interfacing

    2/52

    INTRODUCTION

    Digital quantity 0 or 1

    LOW or HIGH

    True or false

    Analogue Quantity Any value

    Its exact value is significant.

    2

  • 7/24/2019 CSL F Interfacing

    3/52

    INTERFACINGWITHTHEANALOGUEWORLD

    Most physical variables are analog in nature.

    Any information that is an input to a digitalsystem must first be put into digital form.

    Similarly, the outputs from a digital system arealways in digital form.

    When a digital system such as a computer is to beused to monitor and/or control a physical process,

    we must deal with the difference between thedigital nature of the computer and the analognature of the process variables.

    3

  • 7/24/2019 CSL F Interfacing

    4/52

    ADCANDDAC

    4

  • 7/24/2019 CSL F Interfacing

    5/52

    TRANSDUCER

    The physical variable is normally a non-electrical

    quantity.

    A transducer is a device that converts the physical

    variable to an electrical variable. thermostats, photocells, photodiodes, flow meters,

    pressure transducers and tachometers.

    The electrical output of the transducer is an

    analog current or voltage that is proportional to

    the physical variable that it is monitoring.

    5

  • 7/24/2019 CSL F Interfacing

    6/52

    ANALOG-TO-DIGITALCONVERTER(ADC)

    The transducers electrical analog outputserves as the analog input to the ADC.

    The ADC converts this analog input to a

    digital output.This digital output consists of a number of

    bits that represent the value of the analoginput.

    For example, the ADC might convert thetransducers 800- to 1500-mV analog valuesto binary values ranging from 01010000(80) to 10010110 (150).

    6

  • 7/24/2019 CSL F Interfacing

    7/52

    DIGITAL-TO-ANALOG-CONVERTER(DAC)

    This digital output from the computer is

    connected to a DAC, which converts it to a

    proportional analog voltage or current.

    For example, the computer might produce a

    digital output ranging from 00000000 to

    11111111, which the DAC converts to a voltage

    ranging from 0 to 10 V.

    7

  • 7/24/2019 CSL F Interfacing

    8/52

    ACTUATOR

    The analog signal from the DAC is often connectedto some device or circuit that serves as an actuator(convert electrical signal to motion) to control the

    physical variable.

    The ADCs and DACs function as interfacesbetween a completely digital system, such as a

    computer, and the analog world.

    8

  • 7/24/2019 CSL F Interfacing

    9/52

    DIGITAL-TO-ANALOGCONVERSION

    9

  • 7/24/2019 CSL F Interfacing

    10/52

    DIGITAL-TO-ANALOGCONVERSION

    Analog output = K x digital input K is the proportionality factor and is a constant value for

    a given DAC connected to a fixed reference voltage.

    The analog output can be a voltage or a current.

    When it is a voltage, K will be in voltage units

    When the output is a current, K will be in currentunits. 10

  • 7/24/2019 CSL F Interfacing

    11/52

    EXAMPLE

    A five-bit DAC has a current output.For a digital input of 10100, an output current of 10 mA

    is produced.

    What will be for a digital input of 11110?

    11

  • 7/24/2019 CSL F Interfacing

    12/52

    SOLUTION

    10100 is equal to decimal 20.

    Since Iout= 10 mA

    The proportionality factor must be 0.5 mA.

    11110 is equal to decimal 30

    Thus, we can find for any digital input such as as follows:

    Iout= 0.5 mA x 30 = 15.0 mA

    12

  • 7/24/2019 CSL F Interfacing

    13/52

    EXAMPLE

    What is the largest value of output voltage from an

    eight-bit DAC that produces 1.0 V for a digital input of

    00110010?

    13

  • 7/24/2019 CSL F Interfacing

    14/52

    SOLUTION

    14

  • 7/24/2019 CSL F Interfacing

    15/52

    ANALOGOUTPUT

    The number of different possible output valuescan be increase and the difference betweensuccessive values decreased by increasing thenumber of input bits.

    Produce an output that is more and more like ananalog quantity that varies continuously over arange of value.

    15

  • 7/24/2019 CSL F Interfacing

    16/52

    DIGITAL-TO-ANALOGCONVERSION

    16

    A B C D E F Vout

    0 0 0 0 0 0 0

    0 0 0 0 0 1

    0 0 0 0 1 0

    0 0 0 0 1 1

    1 1 1 1 1 1 15

  • 7/24/2019 CSL F Interfacing

    17/52

    DIGITAL-TO-ANALOGCONVERSION

    17

    A B C D E F Vout

    0 0 0 0 0 0 0

    0 0 0 0 0 1 0.2381

    0 0 0 0 1 0 0.4762

    0 0 0 0 1 1 0.7143

    1 1 1 1 1 1 15

    1111112

    = 6310

    K = 15 / 63 = 0.2381

    Vin = 1

    Vout = 1 * 0.2381 = 0.2381

  • 7/24/2019 CSL F Interfacing

    18/52

    INPUTWEIGHTS

    18

  • 7/24/2019 CSL F Interfacing

    19/52

    EXAMPLE

    19

  • 7/24/2019 CSL F Interfacing

    20/52

    SOLUTION

    20

  • 7/24/2019 CSL F Interfacing

    21/52

    RESOLUTION(STEPSIZE)

    Resolution of a D/A converter is defined as thesmallest change that can occur in the analogoutput as a result of a change in the digitalinput.

    The resolution is always equal to the weight ofthe LSBand is also referred to as the step size,since it is the amount that will changes as thedigital input value is changed from one step to

    the next. In general, for an N-bit DAC the number of

    different levels will be 2N, and the number ofsteps will be 2N1. 21

  • 7/24/2019 CSL F Interfacing

    22/52

    RESOLUTION(STEPSIZE)

    22

    4 bit input

    16 levels

    15 stepsResolution = step size

    = weight of LSB

    = 1

  • 7/24/2019 CSL F Interfacing

    23/52

    OUTPUTWAVEFORMSOFADAC

    23

  • 7/24/2019 CSL F Interfacing

    24/52

    RESOLUTION(STEPSIZE)

    Afs is the analog full-scale output

    nis the number of bits.

    24

  • 7/24/2019 CSL F Interfacing

    25/52

    PERCENTAGERESOLUTION

    25

  • 7/24/2019 CSL F Interfacing

    26/52

    WHATDOESRESOLUTIONMEAN?

    The DACs resolution determines how manypossible voltage values can be send to the output.

    6-bit DAC63 possible steps of _______ V

    between 0 and 10V.8-bit DAC255 possible steps of ______V

    between 0 and 10 V.

    The greater the number of bits, the finer the

    resolution (the smaller the step size).

    26

  • 7/24/2019 CSL F Interfacing

    27/52

    BCD INPUTCODE

    27

  • 7/24/2019 CSL F Interfacing

    28/52

    EXAMPLE

    If the weight of A0 is 0.2 V, find the

    step size

    Full size output

    Percentage of resolution

    Vout if D1C1B1A1= 0101, D0C0B0A0= 1000

    28

  • 7/24/2019 CSL F Interfacing

    29/52

    SOLUTION

    Step size = 0.2 V

    Full size output 0.2 * 99 = 19.8V

    Percentage of resolution = 0.2/19.8 *100 = 1 %

    Vout if D1C1B1A1= 0101, D0C0B0A0= 1000

    Vout = 58 * 0.2 = 11.6V

    OR Vout = (8) + (2) +(1.6)

    29

  • 7/24/2019 CSL F Interfacing

    30/52

    EXAMPLE

    A 12 bit BCD DAC has a full scale output of 9.99V.

    Determine the:

    Percentage resolution

    Step size

    30

  • 7/24/2019 CSL F Interfacing

    31/52

    SOLUTION

    Step size = 9.99 / 999 = 0.01 V

    Percentage resolution = 0.01 / 9.99 *100 = 0.1%

    31

  • 7/24/2019 CSL F Interfacing

    32/52

    D/A CONVERTERCIRCUITS

    32

  • 7/24/2019 CSL F Interfacing

    33/52

    DAC SPECIFICATIONS

    Resolution

    Accuracy

    33

  • 7/24/2019 CSL F Interfacing

    34/52

    RESOLUTION

    The percentage resolution of a DAC is dependent

    solely on the number of bits.

    For this reason, manufacturers usually specify a

    DAC resolution as the number of bits.

    A 10-bit DAC has a finer (smaller) resolution

    than an 8-bit DAC

    34

  • 7/24/2019 CSL F Interfacing

    35/52

    ACCURACY

    DAC manufacturers have several ways of

    specifying accuracy.

    The two most common are

    full-scaleerror

    linearity error

    which are normally expressed as a percentage of the

    converters full-scale output (% F.S.).

    35

  • 7/24/2019 CSL F Interfacing

    36/52

    FULLSCALEERROR

    Full-scale error is the maximum deviationof the DACs output from its expected (ideal)value, expressed as a percentage of fullscale.

    For example, If a DAC has an accuracy of0.01% F.S and a full-scale output of9.375V, this percentage converts to

    0.01% x 9.375 V =

    0.9375 mV

    This means that the output of this DAC can,at any time, be off by as much as 0.9375 mVfrom its expected value. 36

  • 7/24/2019 CSL F Interfacing

    37/52

    EXAMPLE

    An 8 bit DAC has a full scale output of 2mAand full scale error of 0.5% F.S. What isthe range of possible outputs for an input of10000000?

    37

  • 7/24/2019 CSL F Interfacing

    38/52

    SOLUTION

    An 8 bit DAC has a full scale output of 2mAand full scale error of 0.5% F.S. What isthe range of possible outputs for an input of10000000?

    Step size = 2m/255 = 7.84A

    100000002 = 128

    The ideal output = 7.84A *128 = 1004A

    The error = 0.5% * 2mA = 10 AThe range : 994 A - 1014 A

    38

  • 7/24/2019 CSL F Interfacing

    39/52

    LINEARITYERROR

    Linearity error is the maximum deviation in step

    size from the ideal step size.

    For example, If the DAC has an expected step

    size of 0.625 V, a full scale value of 9.375 V and a

    linearity error of 0.01% F.S., this would meanthat the actual step size could be off by as much

    as 0.9375 mV.

    39

  • 7/24/2019 CSL F Interfacing

    40/52

    OFFSETERROR

    Ideally, the output of a DAC will be zero voltswhen the binary input is all 0s.

    In practice, however, there will be a very smalloutput voltage for this situation; this is called

    offset error. This offset error, if not corrected, will be added to

    the expected DAC output for all input cases.

    40

  • 7/24/2019 CSL F Interfacing

    41/52

    OFFSETERROR(CONT)

    41

    Input

    code

    Ideal

    Output

    mV)

    Actual

    Output

    mV)

    0000 0 2

    0001 100 102

    1000 800 802

    1111 1500 1502

  • 7/24/2019 CSL F Interfacing

    42/52

    OFFSETERROR(CONT)

    Offset error can be negative as well as

    positive.

    Many DACs will have an external offset

    adjustment that allows you to zero theoffset.

    This is usually accomplished by applying

    all 0s to the DAC input and monitoring

    the output while an offset adjustmentpotentiometeris adjusted until the output

    is as close to 0 V as required.42

  • 7/24/2019 CSL F Interfacing

    43/52

    SETTLINGTIME

    The operating speed of a DAC is usually specifiedby giving its settling time, which is the timerequired for the DAC output to go from zero tofull scale as the binary input is changed from all0s to all 1s.

    Actually, the settling time is measured as thetime for the DAC output to settle within step size (resolution) of its final value.

    For example, if a DAC has a resolution of 10 mV,settling time is measured as the time it takes theoutput to settle within 5 mV of its full-scalevalue.

    43

  • 7/24/2019 CSL F Interfacing

    44/52

    ANALOG-TO-DIGITALCONVERTER(ADC)

    AnADC takes an analog input voltage

    and after a certain amount of time

    produces a digital output code that

    represents the analog input.The A/D conversion process is generally

    more complex and time-consuming than

    the D/A process, and many different

    methods have been developed and used.

    44

  • 7/24/2019 CSL F Interfacing

    45/52

    GENERALBLOCKDIAGRAM

    FORADC

    45

  • 7/24/2019 CSL F Interfacing

    46/52

    ADC DESCRIPTION

    The timing for the operation is provided by the

    input clock signal.

    The control unit contains the logic circuitry for

    generating the proper sequence of operations inresponse to the START COMMAND, which is

    initiates the conversion process.

    The op-amp comparator has two analog inputs

    and a digital output that switches states,

    depending on which analog input is greater.

    46

  • 7/24/2019 CSL F Interfacing

    47/52

    ADC OPERATION

    1.The START COMMAND pulse initiates the operation.

    2. At a rate determined by the clock, the control unitcontinually modified that binary number that is stored in

    the register.3.The binary number in the register is converted to an

    analog voltage, , by the DAC.

    47

  • 7/24/2019 CSL F Interfacing

    48/52

    ADC OPERATION(CONT)

    4. The comparator compares VAXwith the analoginput VA. As long VAX< VAthe comparatoroutput stays HIGH. When VAXexceeds VA by at

    least an amount equal to VT(threshold voltage),the comparator output goes LOW. At this point,VAXis close toVA. The digital number in theregister, which is the digital equivalent of VAX,

    is also the approximate digital equivalent of VA,within the resolution and accuracy of the system

    5. The control logic activates the end-of-conversion signal, EOC, when the conversion is

    complete.

    48

  • 7/24/2019 CSL F Interfacing

    49/52

    DIGITALRAMPADC

    49

  • 7/24/2019 CSL F Interfacing

    50/52

    ADC OPERATION

    Start High

    Resets the counter to 0Inhibits clock pulses from

    passing to the counter.

    DAC output = 0

    VA > VAX

    End of conversion (EOC) = 1Start LowClock pulses through to counter

    VAX increases one step at a time

    VAX > VAEOC = 0Counter stop counting

    VADigital representation of the countercontents

    50

  • 7/24/2019 CSL F Interfacing

    51/52

    4. The comparator compares VAXwith the analoginput VA. As long VAX< VAthe comparatoroutput stays HIGH. When VAXexceeds VA by at

    least an amount equal to VT(threshold voltage),the comparator output goes LOW. At this point,VAXis close toVA. The digital number in theregister, which is the digital equivalent of VAX,

    is also the approximate digital equivalent of VA,within the resolution and accuracy of the system

    5. The control logic activates the end-of-conversion signal, EOC, when the conversion is

    complete.

    51

  • 7/24/2019 CSL F Interfacing

    52/52

    ANYQUESTION?

    52