using labview iii

Upload: engr-nayyer-nayyab-malik

Post on 04-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Using LabView III

    1/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 1

    LabView Exercises: Part IIIThe working VIs should be handed in to the TA at the end of the lab.

    This is a lab under development so we may experience some glitches the first time through. Please bearwith us.

    Initializing the NI 6251 and SCC68sThe NI 6251 Multifunction I/O allows rapid analog to digital conversion and input to the computer as wellas rapid Digital to Analog conversion and output from the computer via the USB port. It also providesdigital I/O capabilities as well as some timer functions. We have interfaced this device to an SCC68 boxcontaining analog and digital buffers to protect the sensitive inputs and outputs of the 6251. These twodevices are connected by a 37 pin cable. The banana plugs and BNC connectors which we have added tothe SCC68 provide a convenient interface to the students experiments.

    Exercise 1: Using MAX to initialize the NI 6251

    The first time this hardware is used on any given computer it must be initialized. The Measurement andAutomation Explorer (MAX) software provides an easy way to identify the NI hardware connected to thecomputer. Follow the following steps:

    1) Once you are sure that the NI 6251 and SCC68 are correctly connected and powered on, launch MAXby double clicking on its icon on the desk-top.

  • 7/30/2019 Using LabView III

    2/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 2

    2) On the left side of the window which MAX opens you will see a column entitled Configuration.Double-click on Devices and Interfaces to expand the sub-category (or click on the + box). Double-

    click on NI-DAQmx Devices. The expanded sub-category should show an NI USB-6251 (Mass Termi-nation): Dev xx (there will only be one such entry for your computer).

    3) Click on the NI USB 6251 entry (it should be showing a green circuit board on the left to indicate thatit is connected).

    4) Click on the Properties tab at the centre top of the window. This will open a Device Propertiesdialog box. On the Accessory tab which is displayed there will be a check-list. Scroll down the list tofind SCC-68 as shown. Click on SCC-68 and on OK.

  • 7/30/2019 Using LabView III

    3/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 3

    5) Now click on the tab Test Panels.. at the top of the window to display the test panel dialog box.

    This panel will allow you to test the functioning of your NI 6251 and the SCC 68 which is connected

  • 7/30/2019 Using LabView III

    4/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 4

    to it.

    6) Begin by testing the Analog Input channels (the first tab). The channels which are connected via theSCC 68 are Dev*/ai4 and Dev*/ai12. First select Channel Name Dev*/ai4 and set up the testfor Continuous Mode, and the RSE Input Configuration, as shown below.

    If there is no signal source connected to the BNC connector labelled AI0 on the SCC 68 the displaychart should show noise similar to that displayed on the figure when you press Start.

    6) Connect the output from your function generator to the input AI0 BNC connector. Since the acquisitionrate specified in the test panel is 1000 Hz (see figure above) your function generator frequency shouldbe set to a frequency which is less than 500 Hz. (You must sample at least twice as fast as thehighest frequency of interest..this is the sampling theorem). Choose a suitably low frequency. Also,the input should have an amplitude less than 10 volts. If the output displayed on the panel is as youdexpect, click on STOP and perform the same test on Channel Name Dev*/ai12 using the same set

    up parameters. If both channels pass this test, move on to the Analog Output test by clicking on theAnalog Output tab at the top of the window.

    7) Connect the Dev*/ao0 output from BNC AO0 on the SCC 68 to your oscilloscope. Set up channel 0as shown below

  • 7/30/2019 Using LabView III

    5/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 5

    You should see a sine wave on your oscilloscope. Change the amplitude and frequency to verify thateverything is working correctly then repeat the test using Dev*/ao0 and the AO1 BNC connector.

    8) Finally, click on theDigital I/O tab at the top of the window and test the 4 output and 4 input digitallines. These are connected to the coloured banana jacks and are labelled DO0 through DO3 and DI0through DI3. Set up the test panel as shown below, using port1 and click on Start. Lines 0 through3 are assigned as inputs while those from 4 through 7 are outputs. All 8 lines are connected internallyto pull-up resistors so the 4 input lines )bits 0 through 3) show up as high unless something pullsthem down. Connect any of the 4 lines DI0 through DI3 to ground using a wire with banana plugsand the corresponding circular green light on the test panel should go dark.. Next, connect one ofthe output lines DO0 through DO3 to an LED (use a 1 k series resistor). Then using the test panelsslide switches you should be able to turn the LED on and off. This demonstrates that the digital I/Ois working. After you have completed these tests you may continue with the next exercise.

  • 7/30/2019 Using LabView III

    6/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 6

    Exercise 2: Data Acquisition Using the NI USB-6251

    plus SCC 68The National Instruments USB-6251 provides 16 single-ended or 8 differential channels of analog input. Itdoes this using a single 16-bit analog to digital converter capable of digitizing at a maximum rate of 1.25MHz. The 16 channels are provided by multiplexing the input to this A/D converter. If more than onechannel is used the maximum aggregate sampling rate is 1.0 MHz (i.e., 500 kHz per channel for 2 channels,etc). It also provides two separate 16 bit analog output channels which can operate at up to 2.86 MHz for asingle channel or 2.0 MHz aggregate for two channels. See the attached data sheet for detailed specifications.

    The NI SCC 68 provides the interface between the NI 6251 and the users experiment. We have enabledtwo analog input channels, channel ai4 and ai12 each of which is buffered by an Analog Devices OP249op-amp to provide operation over the full range of specifications of the NI 6251. The two digital outputsare also buffered by OP249s operating with a series 51 resistor to protect against short-circuits on theoutputs. Finally, we provide 4 digital input lines (port 1, bits 0 to 3) and 4 digital output lines (port 1, bits

    4 to 7) which are buffered by a 74LS244. There is a 560 pull-up resistor on each digital input and output.The NI USB 6251/SCC 68 combination is a flexible and powerful data acquisition and control systemand the exercise described below is an introduction to using such a system.

  • 7/30/2019 Using LabView III

    7/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 7

    Exercise 2: Data Acquisition using the A/D Converter

    In this exercise you will build a LabView VI for acquiring data from the two analog input channels ai4 andai12. The VI allows you to change the sampling rate and to save the data to an .lvf file. (This is LabViewstext formatted data file format.)

    Launch LabView and, under New, click on Blank VI. Decorate your front panel as shown below.

    The corresponding block diagram should be as shown in the next figure.

  • 7/30/2019 Using LabView III

    8/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 8

    You will notice that the block diagram contains three loop structures: the outermost loop is a while loopwhich terminates only when the STOP button is pushed, the large inner loop is a Case structure whichexecutes every time you press the READY button. The small inner loop executes when you push theSave? button and saves the data to a file.

    When you place theDAQ Assistanton the block diagram you will need to configure the physical channelbeing used (dev*/ai4). The configuration dialog box should open when you place it on the block diagram. Ifit doesnt, right click on the icon and, from the menu displayed, select Properties. Set up channel dev*/ai4as shown.

  • 7/30/2019 Using LabView III

    9/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 9

    This VI allows you to collect # of samples data points at Sampling Rate. If you connect a sine waveto the AI0 input channel. The sampled data is displayed on the front panel graph. If you like the look ofthe data you can save it by pressing Save?.

    Save a set of data and open the .lvm file with Windows NotePad to see the organization of the data file.Once your VI is working, save it to give to the TA. Then, click on Save Asand choose Substitute Copy

    for Original and give it a new name so that you can modify the VI for the next exercise.

  • 7/30/2019 Using LabView III

    10/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 10

    Exercise 3: Generating a Square Wave Output using the D/A Converter

    If you modify the VI as shown by the Front Panel and Block Diagrams below, you will be able to generateand output a waveform which you can use to excite some external circuit. The A/D converter can then beuse to view the excitation and the response.

  • 7/30/2019 Using LabView III

    11/34

    Physics 3100 Electronics, Fall 2008, Digital Circuits 11

    As an example we suggest using a square wave excitation of an RLC circuit. Set up the D/A converterto provide a 50 Hz square wave, amplitude of 4 v. using a size of 1024 samples. This output should beconfigured to appear at Physical Channel Dev*/ao0. Build an RLC resonant circuit as shown

    Use the output of the D/A (from BNC AO0) as Vi. Connect AI0 to the input side of the RLC circuit and

    connect AI1 to the output side of the circuit.When you click on the READY button, the VI generates roughly a single cycle of the square wave whichresults in a 4 volt step at the input to the resonance circuit. The circuit then rings at its characteristicfrequency 0 = 1/

    LC. The ringing decays rapidly with time because of the internal resistance of the wire

    used to make L1. Measure the frequency of the ringing and estimate the decay time.Save the VI and give the results to the TA.

  • 7/30/2019 Using LabView III

    12/34

    Requirements and Compatibility | Ordering Information | Detailed Specifications | Pinouts/Front Panel Connections

    !" #"$#%

    ! " #$ % &

    !

    "

    " ##$%& ' (& ) * +',)-.)' /0!

    #, *- /0 ).)

    1 ' ' ) )'2 ,) 3 ')'

    4(-56(1 ' 4(-% )+3 7 .8)' .)).) 3

    4( ). 7 " ++-))' ' ). 9

    4(-:1;.< '8) 7,) ' $=(>? > ')'

    '(()

    With recent bandwidth improvements and new innovations from National Instruments, USB has evolved into a core bus of choice for measurement and automation applications. NM Series high-speed devices for USB deliver high-performance data acquisition in an easy-to-use and portable form factor through USB ports on laptop computers and otherportable computing platforms. NI created NI signal streaming, an innovative patent-pending technology that enables sustained bidirectional high-speed data streams on USB. Thenew technology, combined with advanced external synchronization and isolation, helps engineers and scientists achieve high-performance applications on USB.

    M Series high-speed multifunction data acquisition (DAQ) modules for USB are optimized for superior accuracy at fast sampling rates. They provide an onboard NI-PGIA 2amplifier designed for fast settling times at high scanning rates, ensuring 16-bit accuracy even when measuring all available channels at maximum speed. All high-speed deviceshave a minimum of 16 analog inputs, 24 digital I/O lines, seven programmable input ranges, analog and digital triggering, and two counter/timers. USB M Series devices are idealfor test, control, and design applications including portable data logging, field monitoring, embedded OEM, in-vehicle data acquisition, and academic. High-speed NI USB-625x M

    Series devices have an extended two-year calibration interval.

    *+, % -,%./

    ' &,%

    ?', @5

    ?', = :( " " * )'!

    9- ),-

    %(

    >" :( " )'!

    % % 0/

    3& % %,

    Technical Sale

    Canad(866) 531-628

    [email protected]

    #

  • 7/30/2019 Using LabView III

    13/34

  • 7/30/2019 Using LabView III

    14/34

    9

    9%3,.

    *,,

    9%3,.

    %'/(

    4,./,%'4

    !!'46%/8

    C-

    4)))E)'

    !'46%/8

    C"CC-*

    4)))E)'

    !:'46%/8

    C"CC-

    4)))E)'

    3&9,%

    !!%0

    ,

    F)E)G%)%)9

    CCC-5

    -$;

    -%.;+)')'-/-

    ->54)

    F)D)

    +)')'%)

    .

    &&''(

    CC-

    -A&77)#).Q#).%+)H

    .$()%!A(4$R

    >

    1)3

    7)+)+)')).

    )'+)7,.G

    #).%+)H.$>

  • 7/30/2019 Using LabView III

    24/34

    '.%/0%.

    3,%*%

    *%

    A%4

    6,

    *%8

    A%

    0,

    6,"B-8

    *

    0,

    *%

    '4

    6,

    *%8

    '

    0,

    6,

    *%"B-8

    &3=4

    6,

    *%

    8

    .

    %/%

    1

    %

    6C78

    9(

    1

    %

    3%(

    1

    %

    -

    "

    "

    -

    "

    "

    "

    1)13

    7).)8'..)')37,)'.)+)')8)),+S%

    7+))A6#).Q#).%+)H.$()%!AF)7)))#).Q

    #).%+)H.$

    >PF)'&77)>A1&&77)#).Q#).%+)H.$()%!A(4$R

    >

    %&"'"91&

    %-%%

    4.)7+)

    4(

    "

    5L

    J!5H(L

    J5

    5H(

    L

    J5!

    4("C

    "

    *5L

    *J!5H(L

    J5

    5H(

    L

    J5!

    6')7)))

    :64:

    :)

    >+).'8'3..)

    5-',)

    K3

    K.

    (8))

    *

    I=,

    *)))3'+

    ))'')(8)).3)).)'.)+)')8)

    >%(,-%%69$'/8

    #).)'

    4(

    55L

    J!

    4("C

    55L

    *J!

    5.)0)

    4(

    4("C

    *

    # -

  • 7/30/2019 Using LabView III

    25/34

    ?8)7.))

    :&!H(H&

    ".)

    ?8)7.E

    :(!H(H&

    ".)

    :(.)%7)E

    )3

    5%(5%()5@(5@()')8)

    /0"

    9')8)

    /03).'))')"

    :&.)%7)E

    )3

    5%(5%()5@(5@()')8)

    F))))7.

    H(H&

    /0

    ).7..

    ).3

    /03).'))')"

    9')8)

    F))))7.

    H(H&

    /0

    ).7..

    ).3

    /03).'))')"

    :7)

    5%(5%()5@(5@()')8)

    :1)-+)!

    )..)'(&

    9')8)

    9)...)'(&

    :&:(.)%)

    135H

    (F#(1(.)%8)%

    1&

    .)%

    %()&'.3+)

    "5)7.))'))'))3'8.)783

    #+)'3)

    .')+8),')')').

    ))

    #+))7).).)8

    ')'7.+)3).+)')8)

    )

  • 7/30/2019 Using LabView III

    26/34

    *,,'%-

    $)8)

  • 7/30/2019 Using LabView III

    29/34

    42%%0

    )

    135H(F#(5@(R#F(6

    5@(R#

    1F

    53

    7,)-)))7.

    17

    #)F)7)))#)5)

    #).)%

    %8)%

    .)%#.))

    17

    #)5)#).

    )

    %

    .)%#.))

    %).)7

    6)

    )

    /?R

    1.

    1

  • 7/30/2019 Using LabView III

    30/34

    :1+)5%(5

    %()5@(5@()

    ')8)!

    '

    ').)

    ).)

    9).

    9')8)!

    "))'7

    ''

    ).)).)

    15@(-

  • 7/30/2019 Using LabView III

    31/34

    5@()')8)

    A**

    =

    "

    1

    A=

    1

    %)',7.

    '1('1&

    8)8)'

    5%(5@(')8)

    A=

    *1

    A**

    =

    1

    A=

    *

    1

    5%()')8)

    A**

    =

    "

    1

    A=

    *

    1

    5@()')8)

    A**

    =

    "

    1

    A=

    1

    -%9-1')8).),))',+4(77))'1%

    ')4>)%')4>%!%

    :%)+.))+),))E).)

    7+)')8)'+

    )7)3)7.73

    7)

  • 7/30/2019 Using LabView III

    32/34

    9,)3)E).)

    *

    =:%

    ?

    -,)D

    ,+X'.))))

    -*+)'7

    :)')5

    5H(55'A=).

    9)=,

    -%>

  • 7/30/2019 Using LabView III

    33/34

    >)'.)

    '))!

    4(9-C),#).

    Y

    CY""

    .Y

    *Y

    !

    4(9-C94%

    Y

    YC.

    YY

    !

    4(9-C#).

    Y

    CY""

    ."Y

    *Y

    !

    4(9-C&>

    F)7)+)*/(3)%15%.1267(8

    ?)+

    4(5%(-

    "0!

    4(5%(-

    "C0!

    4(5%(-"

    *0!

    4(5%(-

    "0!

    4(5%(-C

    0!

    4(5%()-

    0!

    4(5%()-C

    0!

    4(5@(-

    0!

    4(5@(-"

    0!

    4(5@(-

    **0!

    4(5@(-C

    **0!

    4(5@()-

    *0!

    4(5@()-C

    0!

    4(9-),

    #).

    0!

    4(9-C),#).

    "

    0!

    4(9-C#).

    0!

    4(9-&>

    ""C0!

    4(9-C&>

    0!

    (&)

    4(5%(5%()5@(5@

    ()-

    -=/:%(

    4(5%(5%()5@(5@

    ()-"C

    -=/:%(

    4(9-),

    #).

    ")

    ,).

    4(9-C),#).

    ),).

    4(9-94%

    94%'*),).

  • 7/30/2019 Using LabView III

    34/34

    4(9-C94%

    *94%'),).

    4(9-

    #).

    -%(

    4(9-C#).

    -%(

    :'8),)

    )5%()')8)!

    '

    '1#@)+)))1#1!

    9-C

    ),#).9-C

    94%),).,

    -1?6

    %2,,>