cecs.wright.educecs.wright.edu/~sthomas/labviewhandout08.docx · web viewlabview handout 8 chapter...

4
LABVIEW HANDOUT 8 CHAPTER 8: THE SEQUENCE STRUCTURE Build an event timer to compare the performance of For Loops and While Loops. Open a Blank VI and name it Loop Timer (Sequence). The Front Panel is as follows: Change the data-type representation of the Number of Elements Control and the For Loop Array and While Loop Array Indicators to I32. Format the For Loop Time (ms) and While Loop Time (ms) Indicators to U32. Place a Flat Sequence Structure on the Block Diagram: Functions>>Programming>>Structures>>Flat Sequence Structure

Upload: ngoliem

Post on 10-Mar-2018

220 views

Category:

Documents


2 download

TRANSCRIPT

LABVIEW HANDOUT 8

CHAPTER 8: THE SEQUENCE STRUCTURE

Build an event timer to compare the performance of For Loops and While Loops. Open a Blank

VI and name it Loop Timer (Sequence). The Front Panel is as follows:

Change the data-type representation of the Number of Elements Control and the For Loop

Array and While Loop Array Indicators to I32. Format the For Loop Time (ms) and While

Loop Time (ms) Indicators to U32. Place a Flat Sequence Structure on the Block Diagram:

Functions>>Programming>>Structures>>Flat Sequence Structure

Additional panes can be created by right-clicking on the border and clicking on Add Frame

After. Create the following VI:

Set the value of Number of Elements to 5 and use the Highlight Execution button to show the

data dependency of the program execution. Turn off the Highlight Execution function and set

the value of Number of Elements to that shown below and run the program:

Write the following event timer that uses artificial data dependency to control the order of

execution. Make a copy of the Loop Timer (Sequence) VI and name it Loop Timer (Data

Dependency). Eliminate the Flat Sequence Structure by right-clicking on the border and

selecting Remove Sequence. Construct the following VI, but do not change the Front Panel:

Set the Number of Elements to 10 and use the Highlight Execution function to demonstrate the

behavior of the program. Instead of using a Sequence Structure enclosing each loop, this

program uses artificial data dependency to control the order of execution. In the artificial data

dependency scheme, the mere arrival of data, with no regard to its actual value, triggers the

execution of a node. For instance, the While Loop cannot start until both inputs arrive. Also, the

Tick Count (ms) function does not engage until the data from the For Loop Start arrives at the

Sequence Structure. Turn off the Highlight Execution function and reset the value of Number

of Elements to that from the previous VI and run the program. The results should be the

approximately the same.