Experiment 1: Introduction to Labview 2010 (tbc 1/7/2007, 1/13/2009,1/9/2012, 1/10/2012) Objective: To learn how to build virtual instrument panels in Labview 2010 Tasks: 1. Follow the tutorial given in Appendix A. 2. Modify the VI to simulate sin 2 Create two more knobs for amplitude 0 2 and 1 1. Try set 0.8 and 0.2, then verify in an Excel plot. Name : Date: Grade: (Pass/Fail) a. Tutorial i. VI ii. Excel Plot b. Main Task i. VI ii. Excel Plot 1
Appendix A: Tutorial for Labview 2010 Example: Build a VI to simulate a sinusoidal signal. I. Initalizing a blank virtual instrument. 1. Log on to Labview 2010 and open a Blank VI. 2. Two windows will appear: a) the Front Panel and b) the Block Diagram. (You could tile both windows side-by-side by selecting [Window] [Tile Left and Right] menu item). Remarks: i) The Front Panel will contain the user interface such as knobs, buttons, indicators and graphs while the Block Diagram window will contain the inner-circuitry (including objects, wirings and other virtual instruments), logic structures (including programming blocks) and timing commands. ii) If either the Front Panel or the Block Diagram window is blocked by another window (e.g. when either window is maximized), one can toggle the focus between the two windows by pressing [CTRL]-[E]. 2
II. Building the VI. Include the following blocks inside the block-diagram window and reproduce the diagram shown in Figure 1. Figure 1. Inserting the function blocks. 1. Access the Functions-pallete, then a. [Right-click] while inside the block-diagram window to show the Functions-pallete. b. Create a While-Loop box. : [Express] [Exec Control] [Whileloop], then click-drag an area in the block-diagram window. 3
Figure 2. Click the while-loop icon, then drag an area in the Block Diagram window. Remarks: i. A [STOP] button will also appear in the front-panel window. ii. For the items below, make sure that all the objects created are inside the [while-loop] box. c. Create an Elapsed-time block: [Express] [Exec Control] [Elaspsed time], drop inside the [while-loop] box, and deselect the Automatically reset after time target option. d. Create a Formula block. : [Express] [Arithmetic & Comparison] [Formula], drop inside the [while-loop] box, then change the settings to those in Table 1: Table 1. Formula block. Input: X1 Input: X2 Formula: Label: P Label: t sin(2*pi*t/p) e. Create a to-dynamic Data block. : [Express] [Signal Manipulation] [to Dynamic Data], drop inside the [while-loop] box, then select Input data type to Single Scalar. f. Create a Wait-Until block. : [Programming] [Timing] [Wait- Until MS] block and drop inside the [while-loop] box, then hover on the left side of the [Wait] block and select [Create] [Constant] and input a value of 10. 4
g. Create a Case-structure box. : [Express] [Exec Control] [Case Structure], then click-drag an area inside the [while-loop] box. h. Create a Write-Meas-file box. : [Express] [Output] [Write Measurement File], drop inside the [Case Structure] window, then change the setting to those given in Table 2. Table 2. Write-Measurement File Box Settings. File Name Segment Headers X-Value Columns <user supplied> No Headers One column per channel Include the following controls inside the [Front Panel] window and reproduce the diagram shown in Figure 3. Figure 3. Front Panel. 5
2. Access the Functions-pallete, then a. [Right-click] while inside the front-panel window to show the Controls-pallete. b. Create a Push-Button Control : [Express] [Buttons & Switches] [Push Button], drop in front panel window, then change the caption from Boolean to Save Data. c. Create a Knob Control : [Express] [Numeric Controls] [Knob], drop in front panel window, then right-click on the knob control, then click-on [Visible Items] [Digital Display]. d. Create a Waveform Chart: [Express] [Graph] [Waveform Chart], drop in front panel window. Right-click on the chart then turn off the [Y-scale] [Autoscale Y] mode, and change the maximum and minimum value of the y-axis to +2 to -2. 3. Build the Wiring Connections Include the wire to connect the blocks in the [Block Diagram] windowas shown in Figure 4. 6
Remarks: Figure 4. Wiring connections. Frequently, a wire may become broken. This is usually marked by an X on the broken wires as shown in Figure 13. This means that the broken wire that has one unattached end. To remove all broken-wires in the Block-diagram window, press [CTRL-B]. Figure 5. A broken wire. 4. Save the VI 5. Run/Test the VI project. [Click] the Run button to run the VI (see Figure 6). 7
. Figure 6. Run Button a. Try moving the knob to change the periods and observe how the wave changes. b. Try to set the period to a value to 5.0 secs. Let the wave settle to periodic response, then click on [Save Data] button. c. Click on the [Stop] button. d. Open an Excel file then plot the data to verify that the period is indeed 5.0 secs. 8