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

Document Type: Tutorial
NI Supported: Yes
Publish Date: Jul 2, 2008


Feedback


Yes No

Related Categories

Products

Development Topic

Industry

Related Links - Developer Zone

Related Links - Products and Services

Exercise: Passing Data and Debugging

0 ratings | 0.00 out of 5
Print

Overview

This exercise will be used to familiar you with what dataflow is within LabVIEW. This is an important topic because dataflow determines the execution order of a program. You will also learn how to debug your program using highlight execution.

Goal

Understand the basic behavior of data flow in the LabVIEW environment as well as how to use highlighted execution to debug code.

Description

This exercise consists of a series of tasks in which will walk you through how data is passed from one element to another in the LabVIEW environment. You will be able to see the sequential steps of execution taken when a program is run using highlighted execution.

Data Flow

1. Launch LabVIEW and open a blank VI.

❑ Select File»New VI

2. Open the front panel of the VI.

3. Place a numeric control on the front panel. 

❑ Navigate to Modern»Numeric»Numeric Control and place this control on the front panel.
❑ Name this control Original.

4. Place a numeric indicator on the front panel. 

❑ Navigate to Modern»Numeric»Numeric Indicator and place this indicator on the front panel.
❑ Name this control Result.

5. Switch to the block diagram.

❑ Select Window»Show Block Diagram.

6. Place an Add function on the block diagram.

❑ From the functions palette select Programming»Numeric»Add and place the function on the block diagram.
❑ Create a constant on one of the inputs of the Add function by right clicking the input and selecting Create»Constant. Give this constant a value of 10.

7. Place a Multiply function on the block diagram.

❑ From the functions palette select Programming»Numeric»Multiply and place the function on the block diagram.
❑ Create a constant on one of the inputs of the Multiply function by right clicking the input and selecting Create»Constant. Give this constant a value of 0.

8. Wire the block diagram as shown below.

❑ Connect the output of the Original control to the input of the Add function.
❑ Connect the output of the Add function to the input of the Multiply function.
❑ Connect the output of the Multiply function to the input of the Result indicator.

9. Switch to the front panel.

❑ Select Window»Show Front Panel.

10. Run the VI. 

Note how the VI ignores the order of operations and the data flow of the program is determined by the sequential order of the wiring of the block diagram.

11. Switch to the block diagram.

❑ Select Window»Show Block Diagram

12. Replace the Multiply function with a Subtract function.

❑ Right click the Multiply function and navigate to Replace»Numeric Palette»Multiply.

❑ Change the value of the Subtract function’s constant to 5.

13. Enable Highlight Execution.

❑ Click the light bulb button towards the top of the block diagram to enable Highlight Execution.


 

14. Run the VI.

❑ Click the Run button on the top near menu bar

❑ Observe how intermediate values are show and the execution of the VI is illustrated.

13. Switch to the front panel.

❑ Select Window»Show Front Panel.

14. Run the VI Again. 

Note how the data flow of the program goes from the Add function to the Subtract function.

15. Close the VI. Save if desired.

End of Exercise

 


Video       Tutorial       Passing Data, Debug, and SubVIs     Modules Home     FIRST Community

0 ratings | 0.00 out of 5
Print

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/).