0% found this document useful (0 votes)
10 views

Instrumentation Lab # 01: Introduction To Labview (General)

The document provides an introduction to various programming concepts in LabVIEW including data types, case structures, loops, and tasks/solutions for practice programs. It discusses: 1) Different data types that can be defined in LabVIEW such as double, integer, boolean, strings, arrays, and clusters. 2) Using case structures for conditional logic like an if/else statement or switch case based on a boolean or numeric input. 3) Two types of loops in LabVIEW - for loops to iterate a set number of times and while loops that act like do/while loops, running at least once before checking a conditional. 4) Examples of tasks and their solutions to practice different concepts like displaying odd

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Instrumentation Lab # 01: Introduction To Labview (General)

The document provides an introduction to various programming concepts in LabVIEW including data types, case structures, loops, and tasks/solutions for practice programs. It discusses: 1) Different data types that can be defined in LabVIEW such as double, integer, boolean, strings, arrays, and clusters. 2) Using case structures for conditional logic like an if/else statement or switch case based on a boolean or numeric input. 3) Two types of loops in LabVIEW - for loops to iterate a set number of times and while loops that act like do/while loops, running at least once before checking a conditional. 4) Examples of tasks and their solutions to practice different concepts like displaying odd

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Instrumentation Lab # 01

Name: -

Roll #:-

Section: -

Date:-

Introduction To LabView (General)


Data Types:
There are various data types in LabView such as Double, Integer, Boolean, Strings, Arrays, and Clusters
etc. These can be defined in LabView as follows.

Task # 01:
Make a VI which will take two Strings as an input; your First
Name and Last Name, Find out the length of each string,
concatenate them and also calculate the length of your
complete Name.

Solution:

Case Structures:
It is used for IF else statement in a LabView or used as a Switch.
For example, we make a program that will perform Addition when Boolean Switch is ON, and perform
Subtraction when Switch in OFF.

Task # 02:
In the above program, we just have 2 options, True and False, Amend the above program for four cases
and replace the Boolean Switch with a Numeric Switch. When user enters 0, it will perform Addition, for
1, Subtraction, for 2, Multiplication and for 3, Division.

Solution:-

Loops:
There are 2 types of Loops in LabView; For Loop and While Loop
For loop is used to iterate the program up to a specific number, for example if you want to run the
program for 5 times, you can fix the value of iterations up to 5 as follows.

The above program will stop when N


equal to 5. The initial value of i is 0. It
is incremented each time until i=5. So the final answer would be 5 as loop has completed its 5 iteration
from 0 to 4.
While Loop:-

In LabView, a while loop acts as do while. The program runs always one time and then depends on the
condition. For example, we make a while loop that should stop when i = 5 as follows.

Task # 03:
Make a VI that will display Odd Numbers starting from 3 and waits for 2 seconds after each next output.
The program should stop until a STOP Button is pressed by the User.
Solution: - Since Odd numbers can be written as 2x+1, so following program will perform the required
task.

You might also like