Tuesday, 5 September 2017

LABVIEW: CHAPTER 3

LabVIEW includes a set of Express VIs that help you analyse signals. This chapter teaches you how to use LabVIEW to perform a basic analysis of a signal and how to save the analysed data to a file.


For this chapter the following exercises are, build a VI that generates a signal, filters the signal, indicates if the signal exceeds a certain limit, and records the data. After you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 1.

Figure 1

-------------------------------------------------------------------------------------------------------------


Step 1: modifying a VI created template

  • Complete the following steps to create a VI that generates, analyse and displays a signal.
  • In the Getting Started window, click New to display the New dialog box.
  • From the Create New list, select VI> From Template>Tutorial (Getting Started)>Generate, Analyse, and Display. This template VI simulates a signal and analyses it for its root mean square (RMS) value.
Figure 2

  • Click the OK button or double-click the name of the template to create a VI from the template.
  • If the Context Help window is not visible, press the <Ctrl-H> keys to display the window. (Mac OS X) Press the <Command-Shift-H> keys.
  • Display the block diagram by pressing the <Ctrl-E> keys.
  • Move the cursor over the Amplitude and Level Measurements Express VI, shown at left. The Context Help window displays information about the behaviour of the Express VI. Keep the Context Help window open. It will provide useful information as you complete the rest of this exercise.
  • Display the front panel and remove the RMS indicator, shown at left. You will not use the RMS functionality of the Amplitude and Level Measurements Express VI for this exercise. However, you can use the Generate, Analyse, and Display template VI with the RMS functionality in the future to reduce development time.
  • Display the block diagram and remove any broken wires that result from removing the RMS indicator. To remove all broken wires from the block diagram, you can press the <Ctrl-B> keys.
  • Then return to the front panel window and right-click the waveform graph indicator. Select Properties from the shortcut menu. The Graph Properties dialog box appears.
  • On the Appearance page, place a checkmark in the Visible checkbox in the Label section and enter Unfiltered Signal in the text box
  • Click the OK button to save the configuration and close the Graph Properties dialog box.
  • Run the VI. The signal appears in the graph.
  • Click the STOP button to stop the VI.


Step 2: adding a signal

  • The Simulate Signal Express VI simulates a sine wave by default. You can customize the simulated signal by changing the options in the Configure Simulate Signal dialog box
  • Complete the following steps to create an additional simulated signal that adds uniform white noise to the sine wave.
  • On the block diagram, use the Positioning tool to select the Simulate Signal Express VI. Hold down the <Ctrl> key and click and drag to create an additional Simulate Signal Express VI on the block diagram. (Mac OS X) Hold down the <Option> key and drag. (Linux) You also can hold down the middle mouse button and drag.
  • Release the mouse button to place the copied Simulate Signal Express VI below the original Simulate Signal Express VI. LabVIEW updates the name of the copied Simulate Signal Express VI to Simulate Signal2.
Figure 3
  • Double-click the Simulate Signal 2 Express VI to display the Configure Simulate Signal dialog box
  • Select Sine from the Signal type pull-down menu.
  • Enter 60 in the Frequency (Hz) text box.
  • Enter 0.1 in the Amplitude text box.
  • Place a checkmark in the Add noise checkbox to add noise to the sine signal.
  • Select Uniform White Noise from the Noise type pull-down menu.
  • Enter 0.1 in the Noise amplitude text box.
  • Enter -1 in the Seed number text box.
  • In the Timing section, select the Run as fast as possible option.
  • In the Signal Name section, remove the checkmark from the Use signal type name checkbox.
  • Enter 60 Hz and Noise in the Signal name text box. When you change the signal name in the Configure Simulate Signal dialog box, LabVIEW changes the name of the signal output on the block diagram. Changing the signal name makes it easier for you to identify the signal type when you view the Express VI on the block diagram.
  • The Result Preview section displays a random signal. The Configure Simulate Signal dialog box should appear.
  • Click the OK button to save the current configuration and close the Configure Simulate Signal dialog box.


Step 3: adding two signals

  • To add two signals together to create one signal, you can use the Formula Express VI. Rather than merging two signals on one graph, the Formula Express VI adds both signals together to create a single signal on the graph. You can use this Express VI to add noise to a signal.
  • Complete the following steps to add the 60 Hz and Noise signal to the Sine signal.
  • In the block diagram window, triple-click the wire that connects the Sine output of the Simulate Signal Express VI to the Signals input of the Amplitude and Level Measurements Express VI and to the Unfiltered Signal indicator. Remove the wire.
  • On the Functions palette, click the Search button to search for the Formula Express VI, shown at left, and add it to the block diagram between the Simulate Signal Express VIs and the Amplitude and Level Measurements Express VI. The Configure Formula dialog box appears.
  • In the Label column, change the label for X1 to Sine and the label for X2 to 60 Hz and Noise. The Formula Express VI automatically enters the first input, Sine, in the Formula text box.
  • Click the + button and then the X2 button to add Sine and 60 Hz and Noise together in the Formula text box.
  • Click the OK button to save the current configuration and close the Configure Formula dialog box.
  • Use the Wiring tool to wire the Sine output of the Simulate Signal Express VI to the Sine input of the Formula Express VI.
  • Wire the 60 Hz and Noise output of the Simulate Signal2 Express VI to the 60 Hz and Noise input of the Formula Express VI.
  • Wire the Result output of the Formula Express VI to the Unfiltered Signal indicator and to the Signals input of the Amplitude and Level Measurements Express VI.
  • Display the front panel by pressing the <Ctrl-E> keys.
  • Run the VI. The signal with added noise appears in the graph
  • Click the STOP button to stop the VI.
  • Select File>Save As and save the VI as Analysis.vi in an easily accessible location.

Step 4: filtering a signal

  • You can use the Filter Express VI to process signals through filters and windows.Complete the following steps to configure the Filter Express VI to filter the signal using an infinite impulse response (IIR) filter.
  • Display the block diagram window and remove the wire that connects the Result output of the Formula Express VI to the Signals input of the Amplitude and Level Measurements Express VI.
  • Remove all broken wires that result from removing the wire.
  • Search for the Filter Express VI, shown at left, and add it to the block diagram between the Simulate Signal2 Express VI and the Amplitude and Level Measurements Express VI. The Configure Filter dialog box appears
  • In the Filter Specifications section, change the Cutoff Frequency (Hz) to 25.
  • Click the OK button to save the configuration and close the Configure Filter dialog box.
Figure 4

  • Display the front panel.
  • Click the Unfiltered Signal waveform graph indicator and press the <Ctrl> key while you drag with the Positioning tool to create an additional waveform graph indicator.
  • Triple-click the Unfiltered Signal 2 label above the new waveform graph indicator and enter Filtered Signal to change the label of the indicator. You also can change the label on the Appearance page of the Graph Properties dialog box.
  • On the block diagram, wire the Result output of the Formula Express VI to the Signal input of the Filter Express VI and to the Unfiltered Signal waveform graph indicator.
  • Wire the Filtered Signal output of the Filter Express VI to the Signals input of the Amplitude and Level Measurements Express VI and to the input of the Filtered Signal waveform graph indicator.
  • Select File>Save. The block diagram of the Analysis VI should appear similar to Figure 5. 

Figure 5

Step 5: modifying the appearance of graphs

  • You can use the Display Format page of the Graph Properties dialog box to specify how the scales of the x-axis and y-axis appear on the graph.Complete the following steps to change the format of the x-axis and y-axis of the Unfiltered Signal and Filtered Signal graphs.
  • In the front panel window, right-click the Unfiltered Signal graph indicator and select Properties from the shortcut menu. The Graph Properties dialog box appears.

Figure 6

  • On the Display Format page, select Time (X-Axis) from the top pull-down menu.
  • Select the Default editing mode option.
  • In the Type list, select Automatic formatting.
  • In the Digits field, enter 6 and select Significant digits from the Precision Type pull-down menu.
  • Place a checkmark in the Hide trailing zeros checkbox.
  • Select Amplitude (Y-Axis) from the top pull-down menu and repeat steps 3–6 so the y-axis configuration matches the x-axis configuration.
  • On the Scales page, select Amplitude (Y-Axis).
  • Remove the checkmark from the Auto scale checkbox.
  • Enter -2.5 in the Minimum text box and 2.5 in the Maximum text box.
  • Click the OK button to save the configuration and close the Graph Properties dialog box.
  • Repeat steps 1–11 to configure the Filtered Signal graph indicator. The x-axis and the y-axis on the Unfiltered Signal and Filtered Signal graph indicators change to reflect the new configuration.

Figure 7

Step 6: analysing the amplitude of a signal

  • You can use the Amplitude and Level Measurements Express VI to analyse the voltage characteristics of a signal.Complete the following steps to reconfigure the Express VI to measure the peak-to-peak amplitude values of the signal.
  • On the block diagram, double-click the Amplitude and Level Measurements Express VI to display the Configure Amplitude and Level Measurements dialog box.
  • In the Amplitude Measurements section, remove the checkmark from the RMS checkbox.
  • Place a checkmark in the Peak to peak checkbox. Peak to peak appears in the Results section with the corresponding value of the measurement.
Figure 8


  • Click the OK button to save the current configuration and close the Configure Amplitude and Level Measurements dialog box. The RMS output of the Amplitude and Level Measurements Express VI changes to reflect the new Peak to Peak output, shown at left. You will use the Peak to Peak output in a later exercise.

Step 7: controlling the speed execution

  • To plot the points on the waveform graphs more slowly, you can add a time delay to the block diagram. A time delay slows the speed at which a VI runs
  • Complete the following steps to control the speed at which the VI runs.
  • On the block diagram, search for the Time Delay Express VI.
  • Place the Time Delay Express VI inside the While Loop. The Configure Time Delay dialog box appears
  • Enter 1.000 in the Time delay (seconds) text box and click the OK button
  • Display the front panel and run the VI. The VI runs more slowly. The loop iterates once every second.
  • Stop the VI. Another way to control the speed of the VI is to alter the rate of data acquisition. On the block diagram, double click the Simulate Signal Express VI to display the Configure Simulate Signal dialog box. Locate the Timing section in the dialog box. The Timing section contains a number of ways to alter the rate of data acquisition and the speed at which a VI runs.
  • For example, one of the default settings of the VI is Simulate Acquisition Timing. This means that the VI mimics the acquisition rate of a hardware device. You can select Run as fast as possible to display data more quickly. In the Samples per second (Hz) text box, the default value is 1000, while the default value in the Number of Samples text box is 100. This means that the VI will output 100 data points spanning 0.1 second. You can change these values to change the amount of data the VI displays, as well as the rate at which the VI displays the data.

Step 8: adding a warning light

  • If you want a visual cue to indicate when a value exceeds a specified limit, you can use a warning light.Complete the following steps to add a warning light to the VI.
  • Display the Controls palette by right-clicking any blank space in the front panel window.
  • On the Express palette, select the LEDs palette.
  • Select the round LED indicator and add it to the front panel to the left of the waveform graphs.
  • Double-click the Boolean label above the LED and enter Warning to change the label of the LED. You will use this LED in a later exercise to indicate when a value has exceeded its limit.
  • Select File>Save As to display the Save As dialog box.
  • Read the various dialog box options. Select the Copy and Substitute copy for original options to create a copy of the original VI and immediately edit the copy.
  • Click the Continue button and save the VI as Warning Light.vi in an easily accessible location.

Step 9: setting a warning level limit

  • To specify the value at which you want the LED to light, use the Comparison Express VI.Complete the following steps to compare the peak-to-peak value to a limit you set.
  • On the block diagram, search for the Comparison Express VI and place it to the right of the Amplitude and Level Measurements Express VI. The Configure Comparison dialog box appears
  • In the Compare Condition section, select the > Greater option.
  • In the Comparison Inputs section, select Value and enter 2 in the Value numeric control to assign a constant value at which you want the LED to light.
  • Click the OK button to save the current configuration and close the Configure Comparison dialog box. The name of the Comparison Express VI changes to reflect the operation of the Express VI, shown at left. Greater indicates that the Express VI does a greater than comparison.
Figure 9


  • Wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Operand 1 input of the Greater Express VI
  • Move the cursor over the wire that connects the Peak to Peak output to the Operand 1 input.
  • When the Positioning tool appears, right-click the wire that connects the Peak to Peak output to the Operand 1 input and select Create» Numeric Indicator from the shortcut menu. A Peak to Peak terminal, shown at left, appears on the block diagram. If the Peak to Peak terminal appears to be on top of the wires between the Express VIs, move the Express VIs and Peak to Peak terminal around to create more space. For example, move the Peak to Peak terminal into blank space above the Express Vis.

Step 10: warning the user

  • After you specify the values at which you want the LED to light, you must wire the LED to the Greater Express VI.Complete the following steps to provide a visual cue when the peak-to-peak value of the signal exceeds a specified limit.
  • In the block diagram window, move the Warning terminal to the right of the Greater Express VI. Make sure the Warning terminal is inside the While Loop, as shown in Figure 10.
Figure 10


  • Wire the Result output of the Greater Express VI to the Warning terminal. The block diagram should appear similar to Figure 10.
  • Display the front panel. A numeric indicator labelled Peak to Peak appears in the front panel window. This indicator displays the peak-to-peak value of the signal.
  • Run the VI. When the peak-to-peak value exceeds 2.0, the Warning indicator lights.
  • Click the STOP button to stop the VI.
  • Save the VI.
Figure 11

Step 11: configuring a vi to save data to a file

  • To store information about the data a VI generates, use the Write To Measurement File Express VI.Complete the following steps to build a VI that saves peak-to-peak values and other information to a LabVIEW data file.
  • Search for the Write To Measurement File Express VI and add it to the block diagram below and to the right of the Amplitude and Level Measurements Express VI. The Configure Write To Measurement File dialog box appears. The Filename text box displays the full path to the output file, test.lvm. A .lvm file is a tab-delimited text measurement file you can open with a spreadsheet application or a text-editing application. LabVIEW saves data with up to six digits of precision in a .lvm file. LabVIEW saves the .lvm file in the default LabVIEW Data directory. LabVIEW installs the LabVIEW Data directory in the default file directory of the operating system. When you want to view the data, use the file path displayed in the Filename text box to access the test.lvm file.

Figure 12


  • In the Configure Write to Measurement File dialog box, locate the If a file already exists section and select the Append to file option to write all the data to the test.lvm file without erasing any existing data in the file.
  • In the Segment Headers section, select the One header only option to create only one header in the file to which LabVIEW writes the data.
  • Enter the following text in the File Description text box: Sample of peak to peak values. LabVIEW appends the text you enter in this text box to the header of the file.
  • Click the OK button to save the current configuration and close the Configure Write To Measurement File dialog box.

Step 12: saving a data file

  • When you run the VI, LabVIEW saves the data to the test.lvm file.Complete the following steps to generate the test.lvm file.
  • On the block diagram, wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Signals input of the Write To Measurement File Express VI.
  • Select File>Save As and save the VI as Save Data.vi in an easily accessible location
  • Display the front panel and run the VI
  • Click the front panel STOP button.
  • To view the data you saved, open the test.lvm file in the LabVIEW Data directory with a spreadsheet or text-editing application. The file has a header that contains information about the Express VI.
  • Close the file after you finish looking at it and return to the Save Data VI.
Figure 13

Figure 14

Step 13: adding a button that stores data when clicked

  • If you want to store only certain data points, you can configure the Write To Measurement File Express VI to save peak-to-peak values only when a user clicks a button.Complete the following steps to add a button to the VI and configure how the button responds when a user clicks it.
  • Display the front panel and search the Controls palette for a rocker button. Select one of the rocker buttons and place it to the right of the waveform graphs.
  • Right-click the rocker button and select Properties from the shortcut menu to display the Boolean Properties dialog box.
Figure 15


  • Change the label of the button to Write to File.
  • On the Operation page of the Boolean Properties dialog box, select Latch when pressed from the Button behaviour list. Use the Operation page to specify how a button behaves when a user clicks it. To see how the button reacts to a click, click the button in the Preview Selected Behaviour section.
  • Click the OK button to save the current configuration and close the Boolean Properties dialog box.
4)      Save the VI.
Figure 16

Figure 17

Step 14: saving data when prompted user

  • Complete the following steps to build a VI that logs data to a file when the user clicks a button on the front panel.
  • In the block diagram window, double-click the Write To Measurement File Express VI to display the Configure Write To Measurement File dialog box.
  • Change the filename test.lvm in the Filename text box to Selected Samples.lvm to save the data to a different file.
  • Click the OK button to save the current configuration and close the Configure Write To Measurement File dialog box.
  • Right-click the Signals input of the Write To Measurement File Express VI and select Insert Input/Output from the shortcut menu to insert the Comment input.
  • Right-click the Comment input of the Write To Measurement File Express VI and select. Select Input/Output>Enable from the shortcut menu to replace the Comment input with the Enable input. The inputs and outputs of an Express VI appear in a predetermined order when you add new inputs and outputs. To select a specific input, you might need to add an input first, and then change the input to the specific one you want to use by right-clicking the input and selecting Select Input/ Output from the shortcut menu.
  • Move the Write to File terminal to the left of the Write To Measurement File Express VI.
  • Wire the Write to File terminal to the Enable input of the Write To Measurement File Express VI.

Step 15: viewing save data

  • Complete the following steps to view the data that you save to the Selected Samples.lvm file.
  • Display the front panel and run the VI. Click the Write to File button several times.
  • Click the STOP button.
  • Open the Selected Samples.lvm file with a spreadsheet or text-editing application. The Selected Samples.lvm file differs from the test.lvm file. test.lvm recorded all the data generated by the Save Data VI, whereas Selected Samples.lvm recorded data only when you clicked the Write to File button.
  • Close the file after you finish looking at it.
  • Save and close the VI.























LABVIEW : CHAPTER 2

In this following chapter, the exercises will be done is by you will open a blank VI and add structures and Express VIs to the block diagram to build a new VI. You will build a VI that generates a signal, reduces the number of samples in the signal, and displays the resulting data in a front panel table. After you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 1.

Figure 1
----------------------------------------------------------------------------------------------------------------------

Step 1: Opening a blank VI
  • If no template is available for the VI you want to build, you can start with a blank VI and add Express VIs to accomplish a specific task. Complete the following steps to open a blank VI.
  • In the Getting Started window, click the Blank VI link in the New section or press the <Ctrl-N> keys to open a blank VI. A blank front panel window and block diagram window appear.
  • Display the block diagram. If the Functions palette is not visible, right-click any blank space on the block diagram to display a temporary version of the Functions palette. Click the thumbtack, shown at left, in the upper left corner of the Functions palette to pin the palette so it is no longer temporary.


Step 2: adding an express VI that stimulates a signal

  • Complete the following steps to find the Express VI you want to use and add it to the block diagram.
  • Select Help>Show Context Help from the front panel or the block diagram to display the Context Help window. You also can click the Show Context Help Window button, shown at left, on the front panel or block diagram toolbar to display the Context Help window.
  • On the Functions palette, select the Express>Input palette and move the cursor over one of the Express VIs on the Input palette. When you move the cursor over a VI, the Context Help window displays information about that VI.
  • Use the information that appears in the Context Help window to find the Express VI that can simulate a sine wave signal. Keep the Context Help window open. The context help provides useful information as you complete the rest of this exercise.
  • Select the Express VI that can simulate a sine wave signal and place it on the block diagram. The Configure Simulate Signal dialog box appears.
  • Move the cursor over the various options in the Configure Simulate Signal dialog box, such as Frequency (Hz) and Amplitude. Read the information that appears in the Context Help window.
  • Configure the Simulate Signal Express VI to generate a sine wave with a frequency of 10.7 and amplitude of 2. The signal in the Result Preview window changes to reflect the configured sine wave.
  • Click the OK button to save the current configuration and close the Configure Simulate Signal dialog box.
  • Move the cursor over the Simulate Signal Express VI and read the information that appears in the Context Help window. The Context Help window displays information about how you configured the Simulate Signal Express VI in addition to the standard context help description.
  • Save the VI as Reduce Samples.vi in an easily accessible location.

Figure 2

Step 3: searching the help and modifying a signal

  • Complete the following steps to use the LabVIEW Help to search for the Express VI that reduces the number of samples in a signal.
  • On the block diagram, move the cursor over the Simulate Signal Express VI to display the Context Help window and click the Detailed help link to display the Simulate Signal topic in the LabVIEW Help. You might have to enlarge or scroll down in the Context Help window to see the Detailed help link.
  • You also can access the LabVIEW Help by right-clicking a VI or function on the block diagram or on a pinned palette and selecting Help from the shortcut menu or by selecting Help>LabVIEW Help.
  • Click the Search tab, enter sample compression in the Type in the word(s) to search for text box, and press the <Enter> key. You can place quotation marks around the phrase to search for the exact phrase. For example, you can enter "sample compression" to narrow the search results. This word choice reflects what you want this Express VI to do—compress, or reduce, the number of samples in a signal. You also can click the Index tab to search keywords and concepts.


Figure 3

  • Double-click the Sample Compression topic in the search results to display the topic that describes the Sample Compression Express VI.
  • After you read the description of the Express VI, click the Add to the block diagram button to place the Express VI on the cursor.
  • Move the cursor to the block diagram.
  • Add the SampleCompression Express VI to the block diagram to the right of the Simulate Signal Express VI.
  • When you know which item, you want to add to the block diagram or front panel, you can use the Quick Drop dialog box to quickly find the item and add it to the block diagram or front panel. Select Quick Drop from the View menu to display this dialog box. You also can press the <Ctrl-Space> keys. (Mac OS X) Press the <Command-Shift-Space> keys.
  • Configure the Sample Compression Express VI to reduce the signal by a factor of 25 using the mean of these values.
  • Click the OK button to save the current configuration and close the Configure Sample Compression dialog box. Use the Wiring tool to wire the Sine output of the Simulate Signal Express VI to the Signals input of the Sample Compression Express VI.


Figure 4

Step 4: customizing a user interface from the block diagram

  • In the previous exercises, you added controls and indicators to the front panel using the Controls palette. You also can create controls and indicators from the block diagram.
  • Complete the following steps to create controls and indicators from the block diagram.
  • On the block diagram, right-click the Mean output of the Sample Compression Express VI and select Create>Numeric Indicator from the shortcut menu to create a numeric indicator. A Mean indicator, shown at left, appears on the block diagram.
  • Right-click the Mean output of the Sample Compression Express VI and select Insert Input/ Output from the shortcut menu to insert the Enable input. In previous exercises, you learned to add inputs and outputs by expanding the Express VI using the down arrows. Using the shortcut menu is a different way to display and select the inputs and outputs of an Express VI.
  • Right-click the Enable input and select Create>Control from the shortcut menu to create a switch. A Boolean control, shown at left, appears on the block diagram. Control terminals have a thicker border than indicator terminals. Also, an arrow appears on the right of the terminal if the terminal is a control, and an arrow appears on the left of the terminal if the terminal is an indicator.
  • Right-click the wire that connects the Sine output of the Simulate Signal Express VI to the Signals input of the Sample Compression Express VI and select Create>Graph Indicator from the shortcut menu.


Figure 5


  • Use the Wiring tool to wire the Mean output of the Sample Compression Express VI to the Sine graph indicator. The Merge Signals function appears.
  • Arrange the objects on the block diagram so they appear as in Figure 6

Figure 6


  • Display the front panel. The controls and indicators you added appear in the front panel with labels that correspond to the inputs and outputs from which you created the controls and indicators.
  • Save the VI

Step 5: configuring a VI to Run continuously until the user stops it

  • In the current state, the VI runs once, generates one signal, and then stops running. To run the VI until a condition occurs, you can use a While Loop.
  • Complete the following steps to add a While Loop to the block diagram.
  • Display the front panel and run the VI. The VI runs once and then stops. The front panel does not have a stop button.
  • Display the block diagram.
  • Click the Search button, shown at left, on the Functions palette, and enter While in the text box. LabVIEW searches as you type the first few letters and displays any matches in the search results text box. If there are objects with the same name, use the information in the brackets to the right of each object name to decide which object to select. Some objects are located on multiple palettes because you can use them for multiple applications.
  • Double-click While Loop <<Execution Control>> to display the Execution Control subpalette and temporarily highlight the While Loop on the subpalette.
  • Select the While Loop on the Execution Control palette.
  • Move the cursor to the upper left corner of the block diagram. Click and drag the cursor diagonally to enclose all the Express VIs and wires, as shown in Figure 7.

Figure 7


  • Release the mouse to place the While Loop around the Express VIs and wires. The While Loop, shown at left, appears with a STOP button wired to the conditional terminal. This While Loop is configured to stop when the user clicks the STOP button.
  • Display the front panel and run the VI. The VI now runs until you click the STOP button. A While Loop executes the VIs and functions inside the loop until the user clicks the STOP button.
  • Click the STOP button and save the VI.


Figure 8

Step 6: using the error list window

  • If a VI contains an indicator you do not want to use, you can delete it.
  • Complete the following steps to remove the Mean indicator from the front panel.
  • Display the front panel and move the cursor over the Mean indicator until the Positioning tool appears.
  • Click the Mean indicator, shown at left, to select it and press the <Delete> key.
  • Display the block diagram. A wire appears as a dashed black line with a red X in the middle, shown at left. The dashed black line is a broken wire. The Run button, shown at left, appears broken to indicate the VI cannot run.
  • Click the broken Run button to display the Error list window. The Error list window lists all errors in the VI and provides details about each error. You can use the Error list window to locate errors.
  • In the errors and warnings list, select the Wire: has loose ends error and click the Help button to display more information about the error.
  • In the errors and warnings list, double-click the Wire: has loose ends error to highlight the broken wire.
  • Press the <Ctrl-B> keys to delete the broken wire. Pressing the <Ctrl-B> keys deletes all broken wires on the block diagram. You can press the <Delete> key to delete only the selected wire.
  • Select View>Error List to display the Error list window. No errors appear in the errors and warnings field.
  • Click the Close button to close the Error list window. The Run button no longer appears broken.



Step 7: controlling the speed of execution


  • To plot the points on the waveform graph more slowly, you can add a time delay to the block diagram. Complete the following steps to control the speed at which the VI runs
  • On the block diagram, search for the Time Delay Express VI, shown at left, on the Functions palette and place it inside the While Loop. You can use the Time Delay Express VI to control the execution rate of the VI.
  • Enter 0.25 in the Time delay (seconds) text box. This time delay specifies how fast the loop runs. With a 0.25 second time delay, the loop iterates once every quarter of a second.


Figure 9

  • Click the OK button to save the current configuration and close the Configure Time Delay dialog box.
  • Display the front panel and run the VI.
  • Click the Enable switch and examine the change on the graph. If the Enable switch is on, the graph displays the reduced signal. If the Enable switch is off, the graph does not display the reduced signal.
  • Click the STOP button to stop the VI.

Step 8: using a table to display data

  • Complete the following steps to display a collection of mean values in a front panel table.
  • Display the front panel.
  • On the Controls palette search for the Express Table indicator and add it to the right of the waveform graph.
  • Display the block diagram. LabVIEW wired the Table terminal to the Build Table Express VI.


Figure 10


  • If the Build Table Express VI and the Table terminal are not selected already, click an open area on the block diagram to the left of the Build Table Express VI and the Table terminal. Drag the cursor diagonally until the selection rectangle encloses the Build Table Express VI and the Table terminal, shown at left. A moving dashed outline, called a marquee, highlights the Build Table Express VI, the Table terminal, and the wire joining the two
  • Drag the objects into the While Loop to the right of the Sample Compression Express VI.
  • If you drag objects near the border of the While Loop, the loop resizes to enclose the Build Table Express VI and the Table terminal after you add the object to the block diagram.
  • Use the Wiring tool to wire the Mean output of the Sample Compression Express VI to the Signals input of the Build Table Express VI.
  • The block diagram should appear as in Figure 11.

Figure 11 

  • Display the front panel and arrange the controls and indicators as shown in Figure 11
  • Run the VI.
  • Click the Enable switch. If the Enable switch is on, the table displays the mean values of every 25 samples of the sine wave. If the Enable switch is off, the table does not record the mean values.
  • Stop the VI.
  • Experiment with properties of the table by using the Table Properties dialog box. For example, try changing the number of columns to one.Save and close the VI.



Figure 12

Step 9: searching for examples

  • To learn more about how you can use a certain VI, you can search for and view an example that uses the VI.Complete the following steps to find and open an example that uses the Time Delay Express VI
  • In the Help section of the Getting Started window, select LabVIEW Help to display the LabVIEW Help.
  • Click the Search tab. In the Type in the word(s) to search for text box enter time delay express VI and press the <Enter> key. (Mac OS X and Linux) Choose the Full Text option in the Search Options section of the Search the LabVIEW Help dialog box to narrow the search results
  • (Windows) Click the Location column header to sort the search results by content type. Reference topics contain reference information about LabVIEW objects such as VIs, functions, palettes, menus, and tools. How-To topics contain step-by-step instructions for using LabVIEW. Concept topics contain information about LabVIEW programming concepts.
  • Double-click the Time Delay Express VI search result to display the reference topic that describes the Time Delay Express VI
  • After you read the description of the Express VI, click the Open example button in the Example section near the bottom of the topic to open an example that uses the Time Delay Express VI.
  • Run the VI and move the vertical pointer slides. The amplitudes of Value A and B change as you move the vertical pointer slides.
  • Stop the VI.
  • Select Window>Show Block Diagram and read the block diagram comments.
  • Close the example VI and open the LabVIEW Help window.
  • Click the Find related examples button to open the NI Example Finder and display a list of examples similar to the example that uses this VI. The NI Example Finder searches among hundreds of examples, including all installed examples and the examples located on the NI Developer Zone at ni.com/zone. You can modify an example to fit an application, or you can copy and paste from one or more examples into a VI that you create.You also can right-click a VI or function on the block diagram or on a pinned palette and select Examples from the shortcut menu to display a help topic with links to examples for that VI or function. To launch the NI Example Finder and browse or search examples, select Help>Find Examples or click the Find Examples link in the Examples section of the Getting Started window.
  • After you experiment with the NI Example Finder and the example VIs, close the NI Example Finder.
























LABVIEW: CHAPTER 3

LabVIEW includes a set of Express VIs that help you analyse signals. This chapter teaches you how to use LabVIEW to perform a basic analys...