[go: up one dir, main page]

0% found this document useful (0 votes)
41 views3 pages

Experiment 7 _Structures in LabVIEW (1)

The document outlines the objectives and outcomes of Experiment 7 in the Measurements and Instrumentation Lab, focusing on implementing various structures in LabVIEW. It details the functionality of while loops, for loops, case structures, and formula nodes, along with interactive examples and a homework assignment. Assessment criteria will be based on rubrics provided on Moodle.

Uploaded by

Fayasal Saleh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

Experiment 7 _Structures in LabVIEW (1)

The document outlines the objectives and outcomes of Experiment 7 in the Measurements and Instrumentation Lab, focusing on implementing various structures in LabVIEW. It details the functionality of while loops, for loops, case structures, and formula nodes, along with interactive examples and a homework assignment. Assessment criteria will be based on rubrics provided on Moodle.

Uploaded by

Fayasal Saleh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Higher Education as it should be

Measurements and Instrumentation LAB – MECA 341L


Spring Semester 2022
Experiment 7 – Structures in LabVIEW

OBJECTIVES
The objective of this lab session is to learn how to implement various structures in LabVIEW.

OUTCOMES
As a result of this lab session, you will be able to
1. Implement a while loop, a case structure, and a for loop in VI.
2. Use these structures in aVI.

LAB SETUP

Equipment:
 NA
Components:
 NA
Software:
 NI LabVIEW

RESOURCES
 Lab Instructors;
 Previous Lab sessions
 LabVIEW core 1 course manual

MECA341L : Measurements and Instrumentation Lab Page-1


Experiment 7 –Structures in LabVIEW

ACTIVITIES

What is a structure?
Structures are elements that control program execution flow. Structures in LabVIEW include While
loops, For loops, Formula Nodes, Case structures and Flat sequences.
Structures are found on the Structures palette of the Functions>>All Fucntions menu
The functions palette becomes visible by right-clicking a mouse in an open area of the block diagram
or by selecting Show Functions Palette from the windows pull down menu.

The while loop:


The while loop structure (figure 1) executes the section of code (subdiagram) until a certain Boolean
condition is satisfied. It has two terminals, the conditional terminal (input) and the iteration (output)
terminal. The Conditional terminal contains a Boolean value that determines whether the loop
performs another iteration. The iteration terminal outputs a numeric of the number of times the loop
has executed.

Figure 1 – example of a while loop

The For loop:


The For loop is an iterative loop structure that repeatedly executes the code inside (subdiagram) its
border a set of N times. It has two integer terminals as shown in figure 2, the count (input) terminal
and the iteration (output) terminal. Both terminals are available for used inside the For loop. The count
terminal contains the number of times the subdiagram in the loop will be executed. The iteration
terminal contains the current number of completed iterations.

Figure 2 – example of a For loop


Experiment 7 –Structures in LabVIEW

The Case Structure:


Case structure is a conditional branching control structure that executes one and only one of its
subdiagrams, based on specific inputs. It is similar to if-Then-Else in conventional programming. The
case structure may have multiple subdigrams that are configured as a stack of cards of which only one
card is visible at a time. The outputs on case structure can have data source per case. The Selector
Label at the top border of each subdiagram in a case structure contains the diagram identifier which
may be numeric, Boolean, or enumerated type control. The Selector label displays the values that
cause the corresponding subdiagram to execute. Although the values in the selector label may be a
single value, a list, or a range of values which may be edited using the labeling tool. These values
automatically adjust to the input data type. The Selector terminal is positioned anywhere along the
border of the case structure. If you pop up on the border a select menu appears from which cases can
be added or deleted.

The Formula Node:


The formula node structure is a node that excecutes formulas. It provides for algebraic formulas to be
programmed and executed. Formulas are entered as a text using syntax commonly used in text-based
languages. Input variables are wired through input terminals created on the border by popping up on
the boarder and choosing Add Input From the pop-up menu. Ouput variables are wired through
output terminals created by popping up on the border and choosing Add Output. The labeling tool is
used to fill in the terminals with their corresponding names. It s also used to type the formula inside
the node.

Activities:
Interactive Example 1: Using the while loop
Create a VI that continuously generates random numbers between 0 and 1000 until it generates a
number that matches a number selected by the user. Determine how many numbers the VI generated
before generating the matching number.

Interactive Example 2: Using the case structure


Create a VI that adds 2 integers x and y if a control Boolean variable is TRUE and subtract them is the
Boolean variable is FALSE.

Homework:
Create a VI that takes the seconds until a plane arrives at an airport and converts the time into a
combination of hours/minutes/seconds. A warning message with an LED is displayed if time exceeds
one hour.

ASSESSMENT
You will be graded based on the rubrics uploaded on Moodle

You might also like