You are on page 1of 7

UNIVERSITI KUALA LUMPUR

MALAYSIAN INSTITUTE OF INDUSTRIAL TECHNOLOGY

LAB 4
LOOPS

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 : 10th September 2017

NAME : Nor Azimah binti Abdul Aziz

STUDENT ID : 57214115143

LECTURER’S NAME : Miss Nur Fazira bt Haris

SUBMISSION DATE : 10th September 2017


JULY 2017 LAB 4

INTRODUCTION

Loops and case statements of text-based programming languages are represented as


structures in graphical programming. Repetition and loop are used to perform an action
frequently with variations in the details each time. LabVIEW consists of FOR Loop and
WHILE Loop. These loops are used to control repetitive operations. Structures on the block
diagram are used to repeat blocks of code and to execute code conditionally or in a specific
order. LabVIEW includes structures like the While Loop, For Loop, Case structure, Stacked
Sequence structure, Flat Sequence structure, Event Structure, and Formula Node. This
chapter introduces the loops in LabVIEW, iterative data transfer in loops and timing a loop
along with functions commonly used with these structures, including the shift register and the
Feedback Node.

OBJECTIVES
At the end of the lab, the student will be able to:
 Understand and practice using Loops in LabVIEW.
 Use Loops as a part of LabVIEW programming and perform basic math operations

SELF ASESSMENT

1. Define is a For Loop. Under what circumstances are For Loops used.
A for loop executes a subdiagram, a set number of times.
2. Define is a While Loop. Under what circumstances are While Loops used.
While loop executes a subdiagram until a condition is met. A while loop stops
executing the subdiagram, inly if the expected value at the conditional terminal exists.
3. Differentiate the usage of conditional terminals, Stop if True and Continue if
True in a While Loop.
Stop if true Continue if true

The while loop executes its subdiagram


The while loop executes its subdiagram
until the conditional terminal receive a
until the conditional terminal receives a
FALSE value.
TRUE value

JCB 30304 DATA ACQUISITION SYSTEM Page 1 of 7


JULY 2017 LAB 4

4. Differentiate between a shift register and a feedback node.

Shift register Feedback node


To transfer values through a loop The feedback node stores data when the
regardless of whether the loop executes loop completes an iteration, sends that
value to the next iteration of loop, and
transfer any data type

LABWORK

1. Write a program to display the numbers and its cube from 1 to 10 using
(a) a For Loop

Figure 1.1 shows the block diagram for For loop

Figure 1.2 shows the front panel for For Loop

JCB 30304 DATA ACQUISITION SYSTEM Page 2 of 7


JULY 2017 LAB 4

(b) a While Loop.

Figure 1.3 shows the block diagram for while loop

Figure 1.4 shows the front panel for while loop

JCB 30304 DATA ACQUISITION SYSTEM Page 3 of 7


JULY 2017 LAB 4

2. Write a program in LabVIEW to print the number, the square and the cubes of only even
numbers from 0 to 100.

Figure 2.1 shows the block diagram

Figure 2.2 shows the front panel

JCB 30304 DATA ACQUISITION SYSTEM Page 4 of 7


JULY 2017 LAB 4

3. Write a program in LabVIEW to generate a Fibonacci series of n numbers where n is


defined by the programmer. Example for the Fibonacci series is: 1 1 2 3 5 8 13 21 34 and
so on.

Figure 3.1 shows the block diagram

Figure 3.2 shows the front panel

4. Create a VI to animate a bird flying. Use the Picture Ring control to insert and
display pictures to be animated.

Figure 4.1 shows the block diagram

JCB 30304 DATA ACQUISITION SYSTEM Page 5 of 7


JULY 2017 LAB 4

Figure 4.2 shows the front panel

JCB 30304 DATA ACQUISITION SYSTEM Page 6 of 7

You might also like