Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Aug 21, 2007


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Exercise 1: Quickly Create a Custom User Interface for Your D/A Converter Application

9 ratings | 3.56 out of 5
Read in | Print | PDF

Overview

Start building your test application by adding front panel controls and indicators on a new LabVIEW VI. This exercise is the first step toward building an application that performs D/A conversion and total harmonic distortion (THD) analysis. Figure 1 shows the results of this exercise.

 

Exercise 1 - Figure 1

Figure 1. Completed Exercise 1

Design the user interface on the front panel (shown in Figure 1). The front panel contains the user controls and indicators for the user to interface with the application. No programming is performed on the front panel.

1.      Launch LabVIEW by selecting Start » All Programs » National Instruments LabVIEW 8.5.

2.      Select File » New VI from the menu on the welcome screen.

3.      To begin designing the front panel, create three numeric controls and three numeric indicators. With one control, you modify the amplitude of the signal while the other two controls contain the limits for the THD analysis. Two of the indicators show an expected THD range and the third indicator shows the actual THD.

a.       Right-click on the front panel to open the Controls Palette and select Numeric » Numeric Control and place the numeric control on the front panel.

Exercise 1 - Figure 2

Figure 2. Numeric Control

Tip: The Controls Palette provides access to many useful front panel controls such as input boxes, command buttons, and gauges.

b.      Double-click on the word Numeric to edit the label. Change the label of the numeric control Signal Amplitude.

c.       Click in the control and enter a value of 10.

d.      Repeat the previous steps (a through c) to create the other two numeric controls. Use the following chart for the control values.

Tip: Alternatively, you can make copies of the control (or any other object) if you click on the control, press and hold the <Ctrl> key, and then drag the control to a new location.

 

Control Name

Value

Minimum Accepted THD %

1

Maximum Accepted THD %

3

 

e.       Right-click on the front panel and select Numeric » Numeric Indicator and place the numeric indicator on the front panel.

Exercise 1 - Figure 3

Figure 3. Numeric Indicator

f.       Change the label of the numeric indicator Actual THD %.

g.       Repeat the previous steps (e through f) to create two more numeric indicators.

h.      Name the numeric indicators Minimum Expected THD % and Maximum Expected THD %.

i.        To save the current values of the controls, select Edit » Make Current Values Default. This ensures that every time the VI is opened, these values are stored.

4.      Next create two Boolean indicators to display the Pass/Fail result of the tests.

a.       Right-click on the front panel and select Boolean » Square LED to create a Boolean.

Figure 4. Square LED

b.      Resize the LED by clicking on the corner of the LED (the pointer changes to an arrow and blue squares appear) and dragging it outward to make it larger.

c.       Right-click on the LED and select Properties to edit the properties of the LED.

d.      From the resulting dialog, select the Appearance tab.

e.       Under the Label section, set the label to Accepted Pass and then uncheck the Visible checkbox.

f.       Under the Colors section, click the dark box next to Off. Change the color to a shade of red.

g.       Enable the Show Boolean Text section.

  • Type in PASSas the On text.
  • Type in FAILas the Off text.
  • Check Lock text in center.
  • The updated properties dialog is shown below.

Exercise 1 - Figure 5

Figure 5. Pass Button Properties

h.      Click OK to exit.

i.        Create a copy of the control by clicking on the LED control and selecting Edit » Copy.

j.        Paste the control onto your front panel by selecting Edit » Paste.

k.      Right-click on the newly created LED and select Properties to edit the properties of the LED.

l.        Under the Label section, check the Visible checkbox. Then set the label to Expected Pass and uncheck the Visible checkbox.

m.    Click OK to exit.

5.      Place two graphs on the front panel to display the acquired signal and the fast Fourier transform (FFT) result.

a.       Right-click on the front panel and select Graph » Waveform Graph.

Exercise 1 - Figure 6

Figure 6. Waveform Graph

Important: Make sure to select the Waveform Graph and not the Waveform Chart. They are sometimes confused because the icons look similar.

b.      Change the label of the graph from Waveform Graph to Analog Signal.

c.       Right-click on the front panel and select Graph » Waveform Graph.

d.      Change the label of the graph from Waveform Graph to FFT.

e.       Right-click on the Waveform Graph labeled FFT and select Properties to edit the properties of the waveform graph. You can use the properties to edit the scales of the graph.

f.       From the resulting dialog, select the Plots tab.

g.       Click the White box next to the Line label in the Colors box. Select a new color for your plot from the resulting color palette.

 


[+] Enlarge Image

Figure 7. Graph Properties Color Palette

h.      Click OK to save your changes.

6.      Arrange the controls, indicators, and graphs so that the front panel looks similar to Figure 8.


[+] Enlarge Image

Figure 8. Front Panel

7.      Do not use the block diagram yet, but switch to the block diagram to see the terminals of the controls and indicators that you have added to the VI.

a.       To switch to the block diagram, select Window » Show Block Diagram.

b.      Rearrange the terminals so that they are similar to Figure 9. The terminals on the left side are your controls while the terminals on the right side are your indicators.

Tip: Controls are front panel objects for entering data into a VI interactively or to a subVI programmatically, such as a knob, push button, or dial. Indicators are front panel objects that display outputs, such as a graph or LED.

c.       If any terminal is missing a label, such as the Boolean indicator, right-click on it and select Visible Items » Label.


[+] Enlarge Image

Figure 9. Block Diagram

8.      Select File » Save and save your VI as Exercise 1.vi. 

  
9 ratings | 3.56 out of 5
Read in | Print | PDF

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).