You are on page 1of 1

4/26/2019 Determining When to Use Sequence Structures - LabVIEW 2012 Help - National Instruments

Home (//www.ni.com/) ❯ Support (//www.ni.com/support/) ❯ Manuals (//www.ni.com/manuals) ❯


LabVIEW 2012 Help (/reference/en-XX/help/371361J-01)

Determining When to Use Sequence Structures


Sequence structures (../../lvconcepts/sequence_structures_concepts/) guarantee the order of execution and prohibit
Table of Contents (/reference/en-
parallel operations. For example, asynchronous tasks that use I/O devices, such as PXI, GPIB, serial ports, and DAQ
XX/help/371361J-01)
devices, can run concurrently with other operations if sequence structures do not prevent them from doing so.
LabVIEW 2012 Help
In these cases, you may need to take advantage of the inherent parallelism in LabVIEW. Avoid overusing sequence
structures in one of the following ways:
Edition Date: June 2012
When you need to control the execution order, consider establishing data dependency between nodes. For example,
you can use flow-through parameters (../../lvconcepts/block_diagram_data_flow/#Flow-Through_Parameters) such Part Number: 371361J-01
as error I/O (../../lvconcepts/error_checking_and_error_handling/) to control the execution order.
Use a Case (../../glang/case_structure/) structure and a While Loop (../../glang/while_loop/). You cannot update an »View Product Info
indicator from multiple frames of the sequence structure, as shown in the following illustration. (http://sine.ni.com/nips/cds/view/p/lang/en/nid
Download Help (Windows Only)
(http://www.ni.com/pdf/manuals/371361j.zip)

In the previous block diagram, a VI used in a test application has a Status indicator that displays the name of the
current test in progress. If each test is a subVI called from a different frame, you cannot update the indicator from
each frame, as shown by the broken wire in the Stacked Sequence (../../glang/sequence_structure/) structure.
Because all frames of a Stacked Sequence structure execute before any data passes out of the structure, only one
frame can assign a value to the Status indicator.

Instead, use a Case structure and a While Loop, as shown in the following block diagram.

Each case in the Case structure is equivalent to a sequence structure frame. Each iteration of the While Loop
executes the next case. The Status indicator displays the status of the VI for each case. Because data passes out of
the structure after each case executes, the Status indicator is updated in the case before the one that calls the
corresponding subVI.

Unlike a sequence structure, a Case structure can pass data to end the While Loop during any case. For example, if
an error occurs while running the first test, the Case structure can pass FALSE to the conditional terminal to end the
loop. However, a sequence structure must execute all its frames even if an error occurs.

WAS THIS ARTICLE HELPFUL?

Helpful Not
Helpful


PRODUCT SUPPORT COMPANY MISSION


NI equips engineers and scientists with
Order status and history Submit a service request About National Instruments
systems that accelerate productivity,
(//www.ni.com/status/) (//sine.ni.com/srm/app/myServiceRequests) (//www.ni.com/company/)
innovation, and discovery.
Order by part number Manuals (//www.ni.com/manuals/) Events (//www.ni.com/en-us/events.html)
(//sine.ni.com/apps/utf8/nios.store? Drivers (//www.ni.com/downloads/drivers/) Careers (//www.ni.com/careers/)
action=purchase_form)
Alliance Partners (//www.ni.com/alliance/) Contact Us (//www.ni.com/contact-us/)
Activate a product (http://www.facebook.com/NationalInstruments)
(//sine.ni.com/myproducts/app/main.xhtml? (//twitter.com/niglobal)
lang=en)
(http://www.linkedin.com/company/3433?
Order and payment information trk=tyah)
(//www.ni.com/how-to-buy/)
(//www.youtube.com/nationalinstruments)

(//privacy.truste.com/privacy-seal/validation?rid=342a514a-c792-40e3-ae36-17c7491387a7) United States 

Legal | (//www.ni.com/legal/) Privacy (//www.ni.com/en-us/about-ni/legal/privacy/privacy-statement.html) | © 2019 National


Instruments. All rights reserved.

zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/avoid_overusing_sequence_structures/ 1/1

You might also like