lab exercise 1: create a simple labview vi objective · lab exercise 1: create a simple labview vi...

15
Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 1 04/07/17 Objective When you have completed this exercise, you will be able: To create a LabVIEW VI that simulates an analog input To plot the data on a waveform graph To test the analog test the input values against a user specified limit To light an LED if the value exceeded that limit. This .vi is similar to the one developed in class with a lot of extra features. 1. Open NI LabVIEW and press <Ctrl-N> to open a blank VI. 2. Arrange and size the Front Panel and Block Diagram windows as you cheese 3. Place a “While Loop” on the Block Diagram to control execution. Select Functions»Express»Exec Control»While Loop Place the While Loop on the Block Diagram Move the cursor to the loop upper left corner, then click & hold left mouse button Move the mouse to the lower right corner, then release the left button Add a Loop Counter Display 4. Place a “Simulate Signal” on the Block Diagram to provide an input signal. Select Functions»Express»Input»Simulate Signal Set Timing to “Simulate Acquisition Timing” 4. Place a graph on the Front Panel to display the signal. Select Controls»Express»Graph Indicators»Graph Set the following Graph Parameters Scales (x): Time (x-Axis) o Autoscale = Off o Minimum = 0 o Maximum = 0.1 Scales (y): Amplitude (y-Axis) o Autoscale = Off o Minimum = -1.0 o Maximum = 1.0 4. Place a Knob on the Front Panel to control the Simulated Signal Frequency. Select Controls»Express»Num Ctrls»Knob Enable Visible Items: Digital Display Set the following Knob Parameters Appearance: Label = Frequency Scale: Minimum = 0 Scale: Maximum = 100

Upload: others

Post on 21-Jul-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 1 04/07/17

Objective When you have completed this exercise, you will be able:

• To create a LabVIEW VI that simulates an analog input

• To plot the data on a waveform graph

• To test the analog test the input values against a user specified limit

• To light an LED if the value exceeded that limit.

This .vi is similar to the one developed in class with a lot of extra features.

1. Open NI LabVIEW and press <Ctrl-N> to open a blank VI.

2. Arrange and size the Front Panel and Block Diagram windows as you cheese

3. Place a “While Loop” on the Block Diagram to control execution.

• Select Functions»Express»Exec Control»While Loop

• Place the While Loop on the Block Diagram

♦ Move the cursor to the loop upper left corner, then click & hold left mouse button

♦ Move the mouse to the lower right corner, then release the left button

• Add a Loop Counter Display

4. Place a “Simulate Signal” on the Block Diagram to provide an input signal.

• Select Functions»Express»Input»Simulate Signal

• Set Timing to “Simulate Acquisition Timing”

4. Place a graph on the Front Panel to display the signal.

• Select Controls»Express»Graph Indicators»Graph

• Set the following Graph Parameters

♦ Scales (x): Time (x-Axis)

o Autoscale = Off

o Minimum = 0

o Maximum = 0.1

♦ Scales (y): Amplitude (y-Axis)

o Autoscale = Off

o Minimum = -1.0

o Maximum = 1.0

4. Place a Knob on the Front Panel to control the Simulated Signal Frequency.

• Select Controls»Express»Num Ctrls»Knob

• Enable Visible Items: Digital Display

• Set the following Knob Parameters

♦ Appearance: Label = Frequency

♦ Scale: Minimum = 0

♦ Scale: Maximum = 100

Page 2: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 2 04/07/17

Page 3: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 3 04/07/17

The block diagram contains a While Loop Control, a Simulate Signal VI, which is configured to simulate a

sine wave, a dial to change the frequency, a graph, and a Loop Counter display. Wire the Frequency Control

and Graph to the Simulate Signal as shown below on the Block Diagram.

5. Switch back to the front panel by pressing <Ctrl-E>. Since the Run button (the white arrow in the top left

corner) is solid, you can run this VI as it is. Click the Run button and examine the operation of the VI.

Set the Frequency to 10.1. When you are finished, click the STOP button on the front panel to stop

running the VI.

Note: If you see the Run button in the upper left corner of both the front panel and the block diagram

change from a solid white arrow, to a broken gray arrow, this new icon indicates that there is an error and

the VI is not currently executable. You must then determine the cause and repair it.

Page 4: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 4 04/07/17

7. Add a Upper Limit Controls»Numeric Controls »Vertical Pointer Slide to be placed on the front

panel. To do this, click the Vertical Pointer Slide and drag it to the front panel. Release the button to

place it.

Page 5: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 5 04/07/17

8. Click the Express menu item on the Controls palette to return to the Express Controls palette

9. Click the LEDs subpalette, and place a Round LED on the front panel

Page 6: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 6 04/07/17

10. Right-click the Vertical Pointer Slide and select Properties. A property page will appear. Examine the

different properties that you can modify. Make the following changes on the Appearance tab:

Label: Limit

Size: Height = 250, Width = 35

Set Display: Check Show digital display(s)

Make the following changes on the Scale tab:

Minimum = 0 Maximum = 1

Move the Digital Display Control below the Sliderer Bar.

Page 7: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 7 04/07/17

11. Right-click the Round LED labeled Boolean, and select Properties. Examine the different properties

that can be modified. Make the following changes on the Appearance tab and click OK to apply the

changes.

Label: Alarm

Size: Height = 72, Width = 72 (Note: for a circular LED, these must be the same.)

Set Colors: On = Red, Off = Green

Page 8: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 8 04/07/17

12. Move the objects on the front panel so it resembles the following.

Page 9: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 9 04/07/17

13. Switch to the block diagram by pressing <Ctrl-E>. Double-click the Simulate Signal Express VI to

bring up its properties window. Examine the different properties you can modify. No changes are

required; therefore, click Cancel to close the properties window.

Page 10: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 10 04/07/17

14. Place the Amplitude and Level Measurements function on block diagram Functions»Express»Signal

Analysis»Amp & Level on the Block Diagram.

Page 11: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 11 04/07/17

15. When you place the Comparison Express VI on the block diagram, a dialog box appears. Select RMS as

shown below.

Page 12: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 12 04/07/17

16. As shown below, wire the output of the Simulate Signal VI to Signals input on the Amplitude and

Level Measurements VI. Right click on RMS output and select Functions»Create»Numeric Indicator

from the context menu.

17. Bring up the functions palette by right-clicking the block diagram. Select Functions»

Express»Arithmetic &Comparison and place the Comparison Express VI on the diagram.

Page 13: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 13 04/07/17

18. When you place the Comparison Express VI on the block diagram, a dialog box appears that lets you

configure what type of comparison you will be doing. Make the following selections, then click OK to

apply these changes and to close the dialog box.

Compare Condition: > Greater

Comparison Inputs: Second signal input

Page 14: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 14 04/07/17

19. Make your block diagram resemble the following image by completing the following steps.

• Connect a wire between the Amplitude and Level Measurements output (RMS) to the the

Operand 1 input of the Comparison block.

• Wire the Limit control to the Operand 2 input of the Comparison block.

• Wire the Result output of the Comparison block to the Alarm indicator.

20. Your completed block diagram should now resemble the following:

21. Switch to the front panel by pressing <Ctrl-E>.

Page 15: Lab Exercise 1: Create a Simple LabVIEW VI Objective · Lab Exercise 1: Create a Simple LabVIEW VI Robert W Harrison 2017 Page 4 04/07/17 7. Add a Upper Limit Controls»Numeric Controls

Lab Exercise 1: Create a Simple LabVIEW VI

Robert W Harrison 2017 Page 15 04/07/17

22. Your completed front panel should resemble the following:

22. Save the VI and name it Exercise1.vi.

23. Run the VI. While running the VI, you can change the Limit value. Also notice that when a data point

received from the Simulate Signal VI is greater than the Limit value, the Alarm indicator lights up.

24. Set Limit to 0.707 and then observe the Alarm Light.

25. Adjust the Frequency to different settings and observe the Alarm Light.

26. When you are finished, stop the VI by clicking the STOP button on the front panel.