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

Document Type: Tutorial
NI Supported: Yes
Publish Date: Jul 19, 2009


Feedback


Yes No

Related Links - Developer Zone

Related Links - Products and Services

Using the Conditional Disable Structure

0 ratings | 0.00 out of 5
Print | PDF

Overview

This tutorial describes the Conditional Disable Structure and how to use it effectively within LabVIEW.

The Conditional Disable Structure

The Conditional Disable Structure executes exactly one of its subdiagrams based on the Symbols and Values defined in the Project Explorer. This is different than a Case Structure in that it is evaluated before the VI or EXE is run, and is defined by the user ahead of runtime. This allows for functionality such as running different code based on operating system, choosing debug options without requiring controls on the Front Panel, etc.

Using the Conditional Disable Structure

To effectively use the full functionality of the Conditional Disable Structure, add your VI to a project. The Conditional Disable Structure is located in the Structures palette (Right-click on the Block Diagram and choose Programming»Structures»Conditional Disable Structure). It is placed on the Block Diagram just like other structures by clicking and dragging to draw it.

The Conditional Disable Structure is initially drawn containing one subdiagram: the Default subdiagram. This subdiagram will be executed if no other subdiagram conditions are satisfied. To create a new subdiagram, right-click on the edge of the Conditional Disable Structure and choose Add Subdiagram After… The Configure Condition dialog box will pop up (see figure below). 

Here you select the condition that is checked before runtime:

  1. Choose Symbol that corresponds to the condition that must be met (i.e. CPU type as shown above)
  2. Choose operator (Execute code if symbol equals a value, or does not equal a value?)
  3. Choose Value that the symbol is checked against (i.e. x86 as shown above)
  4. Add additional conditions if desired by clicking the + button

Once configured, your VI will check the conditions set in the Conditional Disable Structure against the values present in the system. It will execute the first subdiagram whose condition is satisfied. (i.e. if a CPU condition subdiagram is created after an OS condition subdiagram and the OS condition is satisfied, the OS condition subdiagram will be executed and the CPU condition subdiagram will be ignored)

The default subdiagram will be executed if the conditions of no other subdiagrams are met, or if additional conditions are listed in the default case and are met before the other subdiagrams.

To check the current values of a Symbol, or to add custom symbols and values, right-click on My Computer in the Project Explorer and choose Properties. Selecting the Conditional Disable Symbols category will show all current Symbols and their values in the system. Here you can change the current values of symbols by double-clicking on a value in the list. Create a new custom symbol and its value by typing them into their respective fields and clicking Add. See image below.


[+] Enlarge Image

0 ratings | 0.00 out of 5
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/).