You are on page 1of 8

UNIVERSITI KUALA LUMPUR

MALAYSIAN INSTITUTE OF INDUSTRIAL TECHNOLOGY

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)

SEMESTER : JULY 2017

SUBJECT CODE : JCB 30304

SUBJECT TITLE : DATA ACQUISITION SYSTEM

SUBMISSION DATE : 8TH September 2017

NAME : NOR AZIMAH BINTI ABDUL AZIZ

STUDENT ID : 57214115143

LECTURER’S NAME : MISS NUR FAZIRA BINTI HARIS

SUBMISSION DATE : 8TH September 2017


JULY 2017 LAB 4

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

JCB 30304 DATA ACQUISITION SYSTEM Page 1 of 8


JULY 2017 LAB 4

2. How can a new case be added in the case structure?


i. Add a new case at the end of the order
ii. With the new case visible, right click the structure border and select rearrange
cases from the shortcut menu
iii. Click the OK button to save the changes.

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”.

Figure 1(a): Block diagram (true)

JCB 30304 DATA ACQUISITION SYSTEM Page 2 of 8


JULY 2017 LAB 4

Figure (b): block diagram (false)

Figure (c): front panel (true)

Figure (d): front panel (false)

JCB 30304 DATA ACQUISITION SYSTEM Page 3 of 8


JULY 2017 LAB 4

2. Build a VI using case structures to switch between addition, subtraction,


multiplication and division of two numbers.

Figure 2 (a): block diagram

Figure2(b) :front panel

JCB 30304 DATA ACQUISITION SYSTEM Page 4 of 8


JULY 2017 LAB 4

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.

Figure 3(a): Block diagram

Figure 3(b): Front panel

JCB 30304 DATA ACQUISITION SYSTEM Page 5 of 8


JULY 2017 LAB 4

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).

Table 1 BMI Classification

<18.5 Underweight

18.5 – 24.9 Healthy

25 – 29.9 Overweight

≥ 30 Obese

Figure 4(a): Block diagram (false)

JCB 30304 DATA ACQUISITION SYSTEM Page 6 of 8


JULY 2017 LAB 4

Figure 4(b): Block diagram (true)

Figure 4(c): Front Panel

Figure 4(d): Front panel

JCB 30304 DATA ACQUISITION SYSTEM Page 7 of 8

You might also like