1. Open LabVIEW.
2. Open a new VI by clicking on Blank VI in the LabVIEW Getting Started window.
3. Save the VI as Circle Area Perimeter.vi:
• Navigate to the location where you wish to save the VI.
• Name the VI Circle Area Perimeter.vi.
• Click OK.
4. Now we Create the front panel shown in following Figure.
• Right-click on the front panel to open the Controls palette, and put down a Numeric Control from the Modern → Numeric subpalette, as shown in Figure .
• Double-click on the label for this control and rename it to r.
• Place down two numeric indicators from the Modern → Numeric subpalette and rename them Area and Perimeter.
Note:- the distinction between an indicator and a control. A control receives input, while an indicator displays output.
• You can change the font of the labels using the font drop-down menu near the menu bar, as shown in Figure .
5. Open Context Help using the key combination Ctrl-H. When you hover over any block or con-
nector, the Context Help will provide a brief description of its function or its type, depending on
context. This will prove very helpful in creating VIs.
6. Create the block diagram for this VI as shown in Figure 4.
• Right-click on the block diagram to open the Functions palette and place down the necessary
mathematical functions from the Programming → Numeric subpalette, as shown in Figure .
If you will be using a right-click menu frequently, as you did just now, you can ‘pin’ the menu
down by clicking on the button that resembles a pushpin ( ) on the top left corner of the
menu. Also, clicking on the Search button causes the search functionality to persist.
• Place down the necessary constants from the Programming → Numeric → Math Constants subpalette, as shown in Figure .
• Wire the functions as shown in Figure 4.
The key combination Ctrl-E will help you toggle quickly between the front panel and the block
diagram.
7. Run the VI and verify its operation.
• Click on the numeric control r and set its value to 1.5.
• Verify that the area and perimeter indicators return the correct result.
• Run the VI for different values of r and verify its operation.
8. Select the Highlight Execution button in the toolbar of the block diagram ( ), and run the VI
while viewing the block diagram. Notice how data flows from left to right through the block diagram and gets processed by each block. Deselect the button when done.
Self-Exercise
Now that you have learned how to build a simple VI, implement the following VI that calculates the roots of a quadratic equation Ax2 + Bx + C = 0 based on its coefficients. Save this VI as Quadratic Roots.vi.
The front panel is shown in Figure . For this simple exercise, the VI will not support complex roots.
Messy VI block diagram? Do not despair! The key combination Ctrl-U will clean it up for you. The key combination Ctrl-B removes all broken wires.
3. Save the VI as Circle Area Perimeter.vi:
- Select File → Save.
• Navigate to the location where you wish to save the VI.
• Name the VI Circle Area Perimeter.vi.
• Click OK.
4. Now we Create the front panel shown in following Figure.
• Right-click on the front panel to open the Controls palette, and put down a Numeric Control from the Modern → Numeric subpalette, as shown in Figure .
• Double-click on the label for this control and rename it to r.
• Place down two numeric indicators from the Modern → Numeric subpalette and rename them Area and Perimeter.
Note:- the distinction between an indicator and a control. A control receives input, while an indicator displays output.
• You can change the font of the labels using the font drop-down menu near the menu bar, as shown in Figure .
5. Open Context Help using the key combination Ctrl-H. When you hover over any block or con-
nector, the Context Help will provide a brief description of its function or its type, depending on
context. This will prove very helpful in creating VIs.
6. Create the block diagram for this VI as shown in Figure 4.
• Right-click on the block diagram to open the Functions palette and place down the necessary
mathematical functions from the Programming → Numeric subpalette, as shown in Figure .
If you will be using a right-click menu frequently, as you did just now, you can ‘pin’ the menu
down by clicking on the button that resembles a pushpin ( ) on the top left corner of the
menu. Also, clicking on the Search button causes the search functionality to persist.
• Place down the necessary constants from the Programming → Numeric → Math Constants subpalette, as shown in Figure .
• Wire the functions as shown in Figure 4.
The key combination Ctrl-E will help you toggle quickly between the front panel and the block
diagram.
7. Run the VI and verify its operation.
• Click on the numeric control r and set its value to 1.5.
• Verify that the area and perimeter indicators return the correct result.
• Run the VI for different values of r and verify its operation.
8. Select the Highlight Execution button in the toolbar of the block diagram ( ), and run the VI
while viewing the block diagram. Notice how data flows from left to right through the block diagram and gets processed by each block. Deselect the button when done.
Self-Exercise
Now that you have learned how to build a simple VI, implement the following VI that calculates the roots of a quadratic equation Ax2 + Bx + C = 0 based on its coefficients. Save this VI as Quadratic Roots.vi.
The front panel is shown in Figure . For this simple exercise, the VI will not support complex roots.
Messy VI block diagram? Do not despair! The key combination Ctrl-U will clean it up for you. The key combination Ctrl-B removes all broken wires.
No comments:
Post a Comment