Professional Documents
Culture Documents
LAB 5
CASE STRUCTURES
Demonstrate solutions with LabVIEW application that related to the real world problems.
(P3)
Show how to debug a visual programs design using LabVIEW with readability and future
development with ability to establish effective reports, documentation, presentations.
(P3)
STUDENT ID : 57214115143
INTRODUCTION
A sequence structure contains one or more subdiagrams, or frames, that execute in sequential order.
Within each frame of a sequence structure, as in the rest of the block diagram, data dependency
determines the execution order of nodes.
There are two types of sequence structures—the Flat Sequence structure and the Stacked Sequence
structure. Use sequence structures sparingly because they hide code. Rely on data flow rather than
sequence structures to control the order of execution. With sequence structures, you break the left-to-
right data flow paradigm whenever you use a sequence local variable.
A flat sequence structure consists of one or more subdiagrams, or frames, that execute sequentially.
Use the Flat Sequence structure to ensure that a subdiagram executes before or after another
subdiagram.
A Case structure has two or more subdiagrams, or cases. Only one subdiagram is visible at a time,
and the structure executes only one case at a time. An input value determines which subdiagram
executes. The Case structure is similar to switch statements or if...then...else statements in text-based
programming languages.
OBJECTIVES
At the end of the lab, the student will be able to:
Understand and practice using Case Structures, and Flat and Stacked Sequence Structure.
Understand the use of shift registers and feedback nodes.
Appreciate common wiring errors with stuctures.
SELF ASESSMENT
1. List the type of structures available in LabVIEW.
-For loop
-While loop
-Case structures
-Sequence structure
-Event structure
-Timed structures
-Diagram Disable structure
-Conditional disable structure
-Local variables
3. What is the purpose of a case selector in the case structure? What happens to the case
structure if a numeric control is connected to the case selector?
The purpose of a case selector in the case structure is contains the name of the
selector value that corresponds to the case in the center and decrement and increment
arrows on each side.
If a numeric control is connected to the case structure, the case structure can have any
number of cases.
4. Where are flat and stacked sequence structures used?
Use the sequence structures to control the execution order when natural data
dependency does not exist and flow-through parameters are not available.
LABWORK
1. Build a VI to find the square root of a given number. If the given number is a negative
display the message “Error…… Negative Number”.
3. Construct a VI that has three round LEDs on the front panel. When you run the
program, the first LED should turn on and stay on. After one second, the second LED
should turn on and stay on. After two more seconds, the third LED should turn on
and stay on. All LEDs should be on for three seconds, and the program should end.
4. Use a Formula Node to calculate the Body Mass Index (BMI) of an individual person.
The BMI is an internationally used measure of obesity. Calculate the BMI using the
formula:
BMI (703*W ) / H 2
Where W is the weight in pounds and H is the height in inches. Display the calculated
BMI on a numeric indicator.
Classify the body weight according to Table 1 and output a string containing this
information. There should also be a “warning” Boolean output that is True for any
unhealthy input (i.e underweight, overweight or obese).
<18.5 Underweight
25 – 29.9 Overweight
≥ 30 Obese