You are on page 1of 55

ACHARYA INSTITUTE OF TECHNOLOGY

Bengaluru, Karnataka 560107

Department of Electronics & Communication Engineering

LabVIEW Programming

Sub Code: BEC358A

B.E - III Semester, Electronics & Communication Engineering

[As per Choice Based Credit System (CBCS) scheme]

Lab Manual – 2023-24


Name : _________________________________________________________

USN:___________________________________________________________

Branch:______________________________Section:____________________
ACHARYA INSTITUTE OF TECHNOLOGY

Bengaluru, Karnataka 560107

Department of Electronics & Communication Engineering

LabVIEW Programming

B.E - III Semester, Electronics & Communication Engineering

[As per Choice Based Credit System (CBCS) scheme]

Subject Code - BEC358A

Prepared and Reviewed By:


Raghunath B H
Assistant Professor, Department of Electronics & Communication Engineering,
AIT, Acharya, Bangalore -107

Approved By:
Dr. Rajeswari
Head of Department of Electronics & Communication Engineering,
AIT, Acharya, Bangalore -107
ACHARYA INSTITUTE OF TECHNOLOGY
MOTTO
"Nurturing Aspirations Supporting Growth"
VISION
“Acharya Institute of Technology, committed to the cause of sustainable value-based
education in all disciplines, envisions itself as a global fountainhead of innovative
human enterprise, with inspirational initiatives for Academic Excellence”.
MISSION
“Acharya Institute of Technology strives to provide excellent academic ambiance to the
students for achieving global standards of technical education, foster intellectual and
personal development, meaningful research and ethical service to sustainable societal
needs.”

DEPARTMENT OF ELECTRONICS & COMMUNICATION


ENGINEERING
VISION OF THE DEPT
“To be a premier engineering department with excellence in teaching, research and
innovation to meet the global industrial standards and to have significant impact on the
wellbeing of the society”.
MISSION OF THE DEPT
Mission 1. To provide student centric learning environment, inculcate profound
knowledge in both fundamental and applied areas of science and technology.
Mission 2. To train and mentor the students in developing leadership qualities and team
building skills along with professional ethics.
PROGRAM EDUCATIONAL OBJECTIVES (PEOs)
PEO1: Students shall have a successful professional career in industry, academia, R &
D organization or entrepreneur in specialized field of Electronics & Communication
engineering and allied disciplines.
PEO2: Students shall be competent, creative and valued professional in the chosen field.
PEO3: Engage in life-long learning and professional development.
PEO4: Become effective global collaborators, leading or participating to address
technical, business, environmental and societal challenges.
PROGRAM OUTCOMES (POs)
PO1: Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of complex
engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles
of mathematics, natural sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge
and research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources,
and modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities
with the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding
of the engineering and management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability
to engage in independent and life-long learning in the broadest context of technological
change.

PROGRAM SPECIFIC OUTCOMES (PSOs)


PSO1: Analog / Digital Circuit Design: Apply the conceptual knowledge in the
analysis and/or design, evaluate analog/digital circuits and systems.
PSO2: VLSI, Signal Processing and Embedded Systems: Demonstrate technical
competency in the analysis, design and validation of components in VLSI, Signal
Processing, and Embedded Systems
PSO3: Communication and Networking: Apply the domain knowledge in the
implementation and performance analysis of Communication Systems and Computer
Networks.
ACHARYA INSTITUTE OF TECHNOLOGY
Bengaluru, Karnataka 560107
Department of Electronics & Communication Engineering
Syllabus
LabVIEW Programming
Subject Code: BEC358A CIE Marks : 50
SEE Marks : 50 No. of Practical Hrs/Week: 03
Exam Hours: 03 Total no. of Practical Hrs: 42

LIST OF EXPERIMENTS

Sl. VI programs (Using LabVIEW software )to realize the


No following:
1 Basic arithmetic operations: addition,subtraction,multiplication and division

2 Boolean operations: AND,OR,NOT,XOR and NAND

3 Sum of ‘n’ numbers using ‘for’ loop

4 Factorial of a given number using ‘for’ loop

5 Determine square of a given number

6 Factorial of a given number using ‘while’ loop

7 Sorting even numbers using while loop in an array

8 Finding the array maximum and array minimum

Demonstration experiments

9 Build a Virtual instrument that simulates a heating and cooling system .The system
mustbe able to be controlled manually or automatically.

10 Build a Virtual instrument that simulates a basic calculator.

11 Build a virtual instrument that simulates a water level indicator.

12 Demonstrate how to create basic VI which calculates area and perimeter of a circle.
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

COURSE OBJECTIVES:
• Aware of various front panel controls and indicators.
• Connect and manipulate nodes and wires in the block diagram.
• Locate various toolbars and pull down menus for the purpose of implementing specific
functions.
• Locate and utilize the context help window.
• Familiar with LabVIEW and different applications using it.
• Run a virtual instrument(VI).
R A G H U N A T H

COURSE OUTCOMES:
At the end of the course the student will be able to :
1. Use LabVIEW to create data acquisition , analysis and display oerations.
2. Create user interfaces with charts ,graphs and buttons.
3. Use the programming structures and data types that exist in Lab VIEW.
4.Use various editing and debugging techniques.

Dept Of ECE 2
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

LIST OF EXPERIMENTS

Sl.No VI programs(Using LabVIEW software )to realize the following:

1 Basic arithmetic operations:addition,subtraction,multiplication and division

2 Boolean operations:AND,OR,NOT,XOR and NAND

3 Sum of ‘n’ numbers using ‘for’ loop

4 Factorial of a given number using ‘for’ loop

5 Determine square of a given number


R A G H U N A T H

6 Factorial of a given number using ‘while’ loop

7 Sorting even numbers using while loop in an array

8 Finding the array maximum and array minimum

Demonstration experiments

9 Build a Virtual instrument that simulates a heating and cooling system .The system must
be able to be controlled manually or automatically.

10 Build a Virtual instrument that simulates a basic calculator.

11 Build a virtual instrument that simulates a water level indicator.

12 Demonstrate how to create basic VI which calculates area and perimeter of a circle.

Dept Of ECE 3
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Introduction to LabVIEW
Virtual Instrumentation:
Virtual instrumentation is the use of customizable software and modular measurement
hardware to create user-defined measurement systems, called virtual instruments. Traditional
hardware instrumentation systems are made up of pre-defined hardware components, such as
digital multimeters and oscilloscopes that are completely specific to their stimulus, analysis, or
measurement function. Because of their hard-coded function, these systems are more limited
in their versatility than virtual instrumentation systems. The primary difference between
hardware instrumentation and virtual instrumentation is that software is used to replace a large
amount of hardware. The software enables complex and expensive hardware to be replaced by
already purchased computer hardware; e. g. analog-to-digital converter can act as a hardware
complement of a virtual oscilloscope, a potentiostat enables frequency response acquisition
and analysis in electrochemical impedance spectroscopy with virtual instrumentation.
R A G H U N A T H

Layers of Virtual Instrumentation


• Application Software: Most people think immediately of the application software layer. This
is the primary development environment for building an application.
• Test and Data Management Software: Above the application software layer the test executive
and data management software layer. This layer of software incorporates all of the functionality
developed by the application layer and provides system-wide data management.
• Measurement and Control Services Software: The last layer is often overlooked, yet critical
to maintaining software development productivity.

LabVIEW
Laboratory Virtual Instrumentation Engineering Workbench (LabVIEW) is a graphical
programming language that uses icons instead of lines of text to create applications. In contrast
to text-based programming languages, where instructions determine program execution,
LabVIEW uses dataflow programming, where the flow of data determines execution. In
LabVIEW, a user interface can be build by using a set of tools and objects. The user interface
is known as the front panel. Then code can be added using graphical representations of
functions to control the front panel objects. The block diagram contains this code. In some
ways, the block diagram resembles a flowchart.

LabVIEW programs are one of the suitable for virtual instruments, or VIs, because their
appearance and operation imitate physical instruments, such as oscilloscopes and multimeters.
Every VI uses functions that manipulate input from the user interface or other sources and
display that information or move it to other files or other computers.
A VI contains the following three components:
Front panel - Serves as the user interface. Fig 1 shows front panel example.

Block diagram - Contains the graphical source code that defines the functionality of the VI.
Icon and connector panel - Identifies the VI so that the VI can be used in another VI. A VI
within another VI is called a subVI. A subVI corresponds to a subroutine in text-based
programming languages. Fig 2 shows Block diagram of VI programming.

Dept Of ECE 4
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Fig 1. Front Panel of Virtual Instrumentation.vi


R A G H U N A T H

Fig 2. Block Diagram of Virtual Instrumentation.vi

The front panel is the user interface of the VI. The front panel is build with controls and
indicators, which are the interactive input and output terminals of the VI, respectively. Controls
are knobs, pushbuttons, dials, and other input devices. Indicators are graphs, LEDs, and other
displays. Controls simulate instrument input devices and supply data to the block diagram of
the VI. Indicators simulate instrument output devices and display data the block diagram
acquires or generates. After the front panel is build, add code using graphical representations
of functions to control the front panel objects. The block diagram contains this graphical source
code. Front panel objects appear as terminals on the block diagram.
Additionally, the block diagram contains functions and structures from built-in LabVIEW VI
libraries. Wires connect each of the nodes on the block diagram, including control and indicator
terminals, functions, and structures.

LabVIEW Palettes
LabVIEW palettes give provide the options needed to create and edit the front panel and block
diagram. The Tools palette is available on the front panel and the block diagram. A tool is a

Dept Of ECE 5
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

special operating mode of the mouse cursor. By selecting a tool, the cursor icon changes to the
tool icon. Use the tools to operate and modify front panel and block diagram objects.
Select Window » Show Tools Palette to display the Tools palette.
The Tools palette can be placed anywhere on the screen. If automatic tool selection is enabled
and as the cursor is moved over objects on the front panel or block diagram, LabVIEW
automatically selects the corresponding tool from the Tools palette.
The Controls palette
The Controls palette is available only on the front panel. The Controls palette contains the
controls and indicators used to create the front panel. to display the Controls palette, Select
Window » Show Controls Palette or right-click the front panel workspace. The Controls palette
can be placed anywhere on the screen. Fig 3 shows control pallete.
R A G H U N A T H

Fig 3: Controls Palette

The Functions palette


The Functions palette is available only on the block diagram. The Functions palette contains
the VIs and functions used to build the block diagram. To display the Functions palette, select
Window » Show Functions Palette or right-click the block diagram workspace. The Functions
palette can be placed anywhere on the screen. Fig 4 shows Function pallette of LabVIEW.

Dept Of ECE 6
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

Fig 4: Functions Palette


Tips for Working in LabVIEW
• Keystroke Shortcuts
– <ctrl-H> – Activate/Deactivate Context Help Window
– <ctrl-B> – Remove Broken Wires From Block Diagram
– <ctrl-E> – Toggle Between Front Panel and Block Diagram
– <ctrl-z> – Undo (Also in Edit Menu)
• Tab Key – Toggle Through Tools on Toolbar
• Tools » Options… – Set Preferences in LabVIEW
• VI Properties – Configure VI Appearance, Documentation, etc.

Advantages of LabVIEW
– Graphical User Interface
– Drag-and-Drop built-in functions
– Modular design and hierarchical design
– Multiple high level development tools
– Professional Development Tools
– Multi platforms
– Reduces cost and preserves investment
– Flexibility and scalability
– Connectivity and instrument control

Creating a VI
Launch Labview: Fig 5 shows front and block diagram panel of LabVIEW files.

Dept Of ECE 7
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

Fig 5: LabVIEW Windows

Front Panel Controls and Indicators


Controls and Indicators
– Controls are knobs, push buttons, dials and other input devices.
– Indicators are graphs, LEDs and other displays.
– Controls simulate instrument input devices and supply data to the block diagram of
the VI.
– Indicators simulate instrument output devices and display data the block diagram
acquires or generates.
– Every control or indicator has a data type associated with it. They are numeric data
type, boolean data type, string data type

Block Diagram
Terminals
– Front panel object appear as terminals on the block diagram.
– Terminals are entry and exit ports that exchange information between the front panel
and block diagram.
– Terminals are analogous to parameters and constants in text-based programming
languages. Types of terminals include control or indicator terminals and node terminals.
– Control and indicator terminals belong to front panel controls and indicators.
– Data you enter into the front panel controls enter the block diagram through the control
terminals.
– The terminals represent the data type of the control or indicator.
– You can configure front panel controls or indicators to appear as icon or data type
terminals on the block diagram.
– By default, front panel objects appear as icon terminals.

Dept Of ECE 8
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

– To display a terminal as a data type on the block diagram, right-click the terminal and
select View As Icon from the shortcut menu

Wires
– You can transfer data among block diagram objects through wires.
– Each wire has a single data source, but you can wire it to many VIs and functions that
read the data.
– Wires are different colors, styles and thicknesses, depending on their data types.
– A broken wire appears as a dashed black line with a red X in the middle.
– Broken wires occur for a variety of reasons, such as when you try to wire two objects
with incompatible data types.
– You must connect the wires to inputs and outputs that are compatible with the data that
is transferred with the wire.
– You cannot wire an array output to a numeric input.
– In addition, the direction of the wires must be correct. You must connect the wires to
only one input and at least one output.
– You cannot wire two indicators together
R A G H U N A T H

– <Ctrl+B> to delete all broken wires or right click and select Clean Up Wire to reroute
the wire.

Data Flow Program


– LabVIEW follows a dataflow model for running VIs.
– A block diagram node executes when all its inputs are available.
– When a node completes execution, it supplies data to its output terminals and passes
the output data to the next node in the dataflow path.
– Visual Basic, C++, JAVA, and most other text-based programming languages follow a
control flow model of program execution.

Review Questions.
What is virtual instrumentation?
What are the different palettes in VI?
What is sub VI?
What are the advantages of VI?
Compare hardware instrumentation and VI

Dept Of ECE 9
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 1
ARITHMETIC OPERATIONS

AIM:
To perform basic arithmetic operations using LabVIEW.
Addition, Subtraction, Multiplication and division.

THEORY:
To give the 2 inputs numeric controls are selected in Front panel .And all arithmetic operators
can be selected from Functions palette. Addition, subtraction, multiplication and division are
the basic arithmetic operations.
R A G H U N A T H

PROCEDURE:
Step 1: Start the LabVIEW and select the blank VI.
Step 2: Create front and block diagram panel.
Step 3: Numeric controls are given as inputs and numeric indicators are given as output they
are selected by right clicking on the front panel.
Step 4: Different arithmetic operators such as addition, subtraction, multiplication
and division are generated in block diagram panel.
Step 5: Using wiring operation inputs and outputs are connected to the respective
operators in the block diagram panel.
Step 6: Input values are given in the front panel and the program is executed.
Hence the output is generated.

Dept Of ECE 10
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

BLOCK DIAGRAM:
The block diagram for basic arithmetic operations using LabVIEW is shown below in Fig.1.1.
R A G H U N A T H

Fig:1.1:Block diagram of basic arithmetic operations

OUTPUT/FRONT PANEL:
Output of basic arithmetic operations is shown in below fig 1.2.

Fig:1.2:output of basic arithmetic operations

Dept Of ECE 11
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

RESULT:
The arithmetic operations were performed and the result is verified using LabVIEW.

Viva questions:
1. What are the advantages of LabVIEW?

2. What are the two panels used in LabVIEW programming?

3. What is the difference between local variable and global variable in LabVIEW?
R A G H U N A T H

Dept Of ECE 12
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 2
BOOLEAN OPERATIONS
AIM:
To perform Boolean operations using LabVIEW.
AND,OR,NOT,XOR , NAND

THEORY:
The truth table of Boolean operations like AND, OR,NOT,XOR ,and NAND is shown below
in Fig 2.1.The Boolean inputs are given by push buttons in the control palette .All the Boolean
operators can be taken from the functions palette.
R A G H U N A T H

Fig2.1:Truth table of all the logic gates

PROCEDURE:
Step 1: Start the LabVIEW and select the blank VI.
Step 2: Create front and block diagram panel.
Step 3: To perform Boolean operation push buttons are taken as inputs and round LED as
output.
Step 4: Different Boolean operations such as AND, OR, XOR, NOT, NAND are selected from
the block diagram panel.
Step 5: Boolean inputs and outputs are wired in the block diagram panel.

Dept Of ECE 13
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Step 6: Logic values 0 & 1 are given in the front panel and the program is executed.

BLOCK DIAGRAM:
The block diagram of Boolean operations is shown below in Fig.2.2.
R A G H U N A T H

Fig 2.2:Block diagram of Boolean operations

OUTPUT/FRONT PANEL:
The output of Boolean operations is shown below in Fig.2.3.

Fig.2.3: output of Boolean operations

Dept Of ECE 14
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

RESULT:
The Boolean operation using LabVIEW is performed.

VIVA QUESTIONS:
1. Is LabVIEW a compiled programming language?

2. Can LabVIEW be integrated into existing software engineering practices?

3.What is LabVIEW?

Dept Of ECE 15
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 3
SUM OF N NUMBERS USING FOR LOOP
AIM:
To find the sum of ‘n’ numbers using FOR loop.

THEORY:
Usually sum of n numbers, we take for natural numbers.The equation to calculate sum of n
numbers is n(n+1)/2.So we want to take sum of first 3 numbers, n=3.Then as per the equation
it becomes 3(4)/2=6.i.e 3+2+1=6.
FOR loop in LabVIEW is shown below in Fig 3.1.
R A G H U N A T H

Fig 3.1:Structure of FOR loop


In FOR loop, shift registers are used if we make use of previous results.N is the count and I is
the iteration terminal and initial value is zero.

PROEDURE:
Step 1: Create blank VI.
Step 2: First of all move to the front panel and press right then control palette and choose
numeric option place in the front panel and its correspondent will shown block diagram.
Step 3:Right click on the block diagram panel, select program , go to structures and select a
FOR loop.
Step 4: Right click on the border of the FOR loop and select add shift register, borders are
converted into shift register.
Step 5: In block diagrams select the numeric button and choose constant and connect it to
register.
Step 6: Select the add button from the numeric tab. Then select the increment option from the
numeric tab .Connect the output of this increment block to the remaining input of the add block.
Step 7: At the right shift register click right and from the drop down select create and then
select indicator .
Step 8:Inputs are given in the front panel and the program is executed.

Dept Of ECE 16
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

BLOCK DIAGRAM:
The block diagram of sum of n numbers using FOR loop is shown in Fig 3.2 below.
R A G H U N A T H

Fig 3.2: Block diagram of sum of n numbers using FOR loop

OUTPUT/FRONT PANEL:
The output or the front panel view of sum of n numbers using FOR loop is shown below in Fig
3.3.

Fig 3.3: result of sum of n numbers using FOR loop

Dept Of ECE 17
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

RESULT:
R A G H U N A T H

Thus the sum of ‘n’ natural numbers using FOR loop is performed in LabVIEW.

VIVA QUESTIONS:
1.What is shift register?How is it implemented in Lab VIEW?
2.Can LabVIEW Vis be merged?
3. What is LabVIEW signal express?

4.What is Formula node in LabVIEW?


5.In which palette,FOR loop is available?

Dept Of ECE 18
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 4
FACTORIAL OF A NUMBER
AIM:
To perform the factorial of a given number using FOR loop.

THEORY:
Factorial is an important function, which is used to find how many ways things can be arranged
or the ordered set of numbers. The factorial concept is used in many mathematical concepts
such as probability, permutations and combinations, sequences and series, etc. In short, a
factorial is a function that multiplies a number by every number below it till 1. For example,
the factorial of 3 represents the multiplication of numbers 3, 2, 1, i.e. 3! = 3 × 2 × 1 and is equal
to 6.
R A G H U N A T H

A For Loop is a structure you use to execute a block of code a set number of times. When the
VI runs, the iteration count is evaluated, and then the code is executed.A For Loop can be
configured to conditionally stop code execution in addition to its iteration-based exit. In these
cases, the code will execute until the count terminal setting is reached or the condition is met
– whichever happens first.The structure of FOR loop in LabVIEW is shown below in Fig.4.1.

Fig:4.1 Structure of FOR loop

In FOR loop structure , N is the count and I is the iteration value. Initial value of I is zero.

PROCEDURE
Step 1: Create blank VI.
Step 2: Click right on the front panel from the control palette selects numeric and then
selects control .
Step 3: Right click on the block diagram panel , select program , go to structures and select a
FOR loop.

Dept Of ECE 19
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Step 4: Connect the numeric control in which the user input will be stored to the N. Right click
on the border of the FOR loop and select add shift register, borders are converted into shift
register.
Step 5: To initialize the shift register, from the function palette select numeric and then select
constant. Place this numeric with the shift register and set its value to 1.
Step 6: For the multiplication task place a multiply block, from the function
palette select numeric and then select multiply. At one of the two inputs of the multiply block
connect the right shift register, and the output of this block connect the right shift register.
Step 7: On the other input of the multiply block we have to connect the incremented iteration
because the number of iterations start from 0 but we want the factorial from 1 onwards, because
the factorial will turn out to be zero otherwise. From the function palette select numeric and
then select increment.
Step 8: At the input of this increment block connect the iterative index of the for loop, and
R A G H U N A T H

connect the output of this increment block to the remaining input of the multiply block.
Step 9: At the right shift register click right and from the drop down select create and then
select indicator.
Step 10:Inputs are given in the front panel and the program is executed.

BLOCK DIAGRAM:
Block diagram of factorial of a number using FOR loop is given below in Fig.4.2.

Fig.4.2: Block diagram of Factorial of a number using FOR loop

Dept Of ECE 20
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

OUTPUT/FRONT PANEL:
The output of factorial of a number using FOR loop is shown below in Fig.4.3.
R A G H U N A T H

Fig:4.3: Output of factorial of a number using FOR loop

RESULT:
The factorial of a given number is using FOR loop is performed in LabVIEW.

VIVA QUESTIONS:
1. How mixed data types are combined and passed from one file or place to the other in
LabVIEW?
2. What is the initial value of iteration count?
3. What is subVI?
4. What is block diagram panel?
5. What is front panel?

Dept Of ECE 21
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 5
DETERMINE SQUARE OF A GIVEN NUMBER
AIM:
To determine Square of a given number using LabVIEW.

THEORY:

The Square root VI computes the square root of the input value. If x is negative, the square root is NaN
unless x is complex. If x is a matrix, this function takes the matrix square root of x. The connector pane
displays the default data types for this polymorphic function. x can be a scalar number, array or cluster
of numbers and array of clusters of numbers. sqrt(x) is a double-precision, floating-point number if x
is an integer. If x is less than 0, sqrt(x) is not a number (NaN).

PROCEDURE:
R A G H U N A T H

Step 1: Create blank VI.


Step 2: Right click on the block diagram window, select numeric, add numeric constant to
represent the input.
Step 3: Right click on the block diagram window, select numeric, add numeric constant to
represent the output. Change the control to indicator.
Step 3: Right Click on the block diagram window, select numeric, add the square root block.
Step 4: Using wiring operations required connections are given in the block diagram.
Step 5: Inputs are given in the front panel and the program is executed.

BLOCK DIAGRAM:
Block diagram to calculate square and square root of a number is shown below in fig 5.1.

Fig.5.1: To find square root of a number (additionally factorial and square of number is also
shown)

Dept Of ECE 22
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

OUTPUT/FRONT PANEL:
R A G H U N A T H

Fig.5.2:Output of square of a given number

RESULT:
Square of a given number is determined using LabVIEW.

VIVA QUESTIONS:
1. What is the output of square root block if input is negative number?
2. What is the default data type for input for square root block?
3. Can square root block help in finding roots of a complex number?
4. What is the datatype for integer or floating-point number?

Dept Of ECE 23
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 6
FACTORIAL OF A NUMBER USING WHILE LOOP

AIM :
To find factorial of a number using while Loop in LabVIEW.

THEORY:
Use shift registers when you want to pass values from previous iterations through a loop to the
next iteration. A shift register appears as a pair of terminals, shown as follows, directly opposite
each other on the vertical sides of the loop border. The terminal on the right side of the loop
contains an up arrow and stores data on the completion of an iteration. LabVIEW transfers the
data stored in the right terminal of the shift register to the left terminal. The loop then uses the
R A G H U N A T H

data from the left terminal as the initial values for the next iteration. This process continues
until all iterations of the loop execute. After the loop executes, the terminal on the right side of
the loop returns the last value stored in the shift register. A shift register transfers any data type
and automatically changes to the data type of the first object wired to the shift register. The
data you wire to the terminals of each shift register must be the same type. If you have multiple
operations that use previous iteration values within a loop, use multiple shift registers to store
the data values from those different processes in the structure, as shown in the following block
diagram in Fig 6.1 and 6.2.

PROCEDURE:
Step 1: Create blank VI.
Step 2: Right click on the block diagram panel , select program , go to structures
and select a WHILE loop.
Step 3: Right click on the border of the WHILE loop and select add shift register,borders are
converted into shift register.
Step 4: Using wiring operations required connections are given in the block
diagram.
Step 5: Inputs are given in the front panel and the program is executed.

Dept Of ECE 24
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

BLOCK DIAGRAM :
R A G H U N A T H

Fig.6.1 Block diagram using For loop

Fig 6.1 Block diagram using while loop

Dept Of ECE 25
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

OUTPUT/FRONT PANEL:
The output or the front panel window view is shown below in fig 6.2.

Fig.6.2 output

RESULT:
Factorial of a number is determined using while loop in LabVIEW.
R A G H U N A T H

VIVA QUESTIONS:
1. What is the role of shift register in the while loop?
2. What is the default data type for factorial block?
3. How to find factorial of integer numbers?
4. Differentiate for loop and while loop.

Dept Of ECE 26
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 7
SORTING EVEN NUMBERS USING WHILE LOOP IN AN
ARRAY

AIM:
To sort even numbers using WHILE loop in an array.

THEORY:
Loops are used for controlling the iteration and execution flow of programs. Charts display
the recent data and update periodically by maintaining a history of the past data.
While Loop
While Loop executes a subdiagram until a condition is met. The While Loop executes the
R A G H U N A T H

subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value.
The default behavior and appearance of the conditional terminal is Continue If True. When a
conditional terminal is Continue If True, the While Loop executes its subdiagram until the
conditional terminal receives a FALSE value. To change the behavior and appearance of the
conditional terminal, right-click on the terminal and select Stop If True. When a conditional
terminal is Stop If True, the While Loop executes its subdiagram until the conditional terminal
receives a TRUE value. Because the VI checks the conditional terminal at the end of each
iteration, the While Loop always executes at least one time. The VI is broken if the conditional
terminal is not wired. Fig 7.1 shows example of while loop structure
Basic error handling can be performed using the conditional terminal of a While Loop. When
an error cluster s wired to the conditional terminal, only the TRUE or FALSE value of the
status parameter of the error cluster passes to the terminal. Also, the Stop If True and
Continue If True shortcut menu items change to Stop If Error and Continue while Error. The
iteration terminal (an output terminal) contains the number of completed iterations. The
iteration count always starts at zero. During the first iteration, the iteration terminal returns 0.

Fig.7.1. While Loop structure


• A While Loop executes a subdiagram until a condition is met.
• The While Loop is like a Do Loop or a Repeat-Until Loop in text-based

Dept Of ECE 27
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

programming languages.
• The While Loop always executes at least once.
• The For Loop differs from the While Loop in that the For Loop executes a set
number of times.
• A While Loop stops executing the subdiagram, only if the expected value at the
conditional terminal exists.
• In LabVIEW, the WHILE Loop is located on the Functions » Programming »
Structures palette.
• You also can place a For Loop on the block diagram, right-click the border of the
For Loop, and select Replace with While Loop from the shortcut menu to change a
For Loop to a While Loop.
• The While Loop contains two terminals, namely Conditional Terminal and Iteration
Terminal.
• The Conditional Terminal is used to control the execution of the loop, whereas the
Iteration Terminal is used to know the number of completed iterations.
R A G H U N A T H

PROCEDURE:
Step 1: Create blank VI.
Step 2: Right click on the Block diagram panel →structures→ while loop
Step 3: Right click on the Block diagram panel (inside while loop) → array→ index array
Step 4: Right click on the index array (input side) →create →control
Step 5: Right click on the Block diagram panel →array →array size
Step 6: Right click on the Block diagram panel →numeric→ Quotient & Remainder
Step 7: Right click on the Block diagram panel → Comparison→ Equal to 0?
Step 8: Right click on the Block diagram panel →numeric→ numeric constant
Step 9: Right click on the Block diagram panel →numeric→ decrement
Step 10: Right click on the Block diagram panel →numeric→ numeric constant
Step 11: Right click on the Block diagram panel → Comparison→ Equal ?
Step 12: Using wiring operations required connections are made as given in the block diagram
inside loop.
Step 13: Make a connection to while loop from index array
Step 14: Right click step 13 connection (on loop) →Tunnel mode→ Indexing
Step 15: Right click step 14 connection (on loop) →Tunnel mode→Conditional
Step 16: Right click on the Block diagram panel →array→ sort 1D array
Step 17: Right click on the sort 1D array (input side) →create→ control [Even array]
Step 18: Right click on the sort 1D array (output side) →create→ control [Sorted array]

Dept Of ECE 28
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Step 19: Using wiring operations required connections are made as given in the block diagram
outside loop.

BLOCK DIAGRAM:
Fig 7.2 shows the block diagram of sorting even numbers using while loop. The array takes the
input values. Using indexing values are accessed, and checked for even or not. To check for
even number the element value is divided by two and resulting remainder if zero considered as
even. This data is stored in output array. Using sort function, array is sorted.
R A G H U N A T H

Fig7.2.Block diagram Sorting even Number in LabVIEW

OUTPUT/ FRONT PANEL :

Fig.7.3.Input and output of sorted even numbers

RESULT:
Fig 7.3 shows the input array and sorted array. Even numbers are sorted using while loop in an
array.

Dept Of ECE 29
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

VIVA QUESTIONS:
1. What are the different loops available in LabVIEW?
2. Distinguish between for and while loop.
3. What is loop iteration control?
4. What is Multitracing?
R A G H U N A T H

Dept Of ECE 30
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 8
FINDING ARRAY MAXIMUM AND ARRAY MINIMUM

AIM:
To find the maximum and minimum variable from an array.

THEORY:
Arrays
• A group of homogeneous elements of a specific data type is known as an array.
• Arrays hold a sequence of data elements,usually of the same size and same data
type placed in contiguous memory locations.
• Individual elements are accessed by their position in the array.
• The position is given by an index, which is also called as subscript
R A G H U N A T H

• Some arrays are multi-dimensional, generally one -and two- dimensional arrays are
the most common.
• You can build arrays of numeric, boolean, path, string and cluster data types.
• You cannot create arrays of arrays

1D Array Controls, Indicators and Constants


• The index ranges from 0 to 3. The first element in the array is at index 0, the second
element is at index 1, etc..
• In an array the element selected in the index display always refer to the element
shown in the upper left corner of the element display.
• The element (9) at index 0 is not shown in the array, because index 1 is selected in
the index display.
• Steps for creating an array constant
• Select an array constant from Functions » Programming » Arrays. Array shell
appears with an index display on the left, an empty element display on the right.
• Place a constant in the array shell.
• The array shell automatically resizes to accommodate the object place in the array
shell.
• Alternative method is to copy an existing array on the front panel to the block
diagram to create a constant of same data type.

Initializing Arrays
• When an array is initialized, define the number of elements in each dimension and
contents of each element.
• An uninitialized array has a dimension but no elements.
• An uninitialized array control with all the elements are dimmed indicating that the
array is uninitialized.

Inserting Elements within Arrays


– One can insert an element into a 1D array and a row or column into a 2D array.

Dept Of ECE 31
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

• To add an element 1D, right click the array on the front panel and select Data Operation
» Insert Element Before.
• To add a row or column to a 2D array, right click the array on the front panel and select
Data Operations » Insert Row Before or Insert Column Before.
• One can insert elements, rows, column into arrays using the Insert Into Array function.
• Place an Insert Into Array function on the block diagram.
• The index input specifies the element, row, column where to insert the element or array
with 0 being the first.
• Elements are added before the value wire to index.
2D Arrays
• A 2D arrays stores elements in a grid.
• It requires a column index and a row index to locate an element both of which are zero-
based.
• To create a 2D array on the front panel, right click the index display of the array and
select Add Dimension from the shortcut menu.
R A G H U N A T H

Deleting Elements within Arrays


• One can delete an element within a 1D array and a row or column within a 2D.
• To delete an element in a 1D array, right-click the array element on the front panel and
select Data Operations » Delete Element.
• To delete a row or column in a 2D array, right-click the array row or column on the
front panel and select Data Operations » Delete Row or Delete Column
• Can delete elements, rows, columns and pages within array using the Delete From
Array function.

Replacing Elements within Arrays


• Place the Replace Array Subset function on the block diagram
• Wire an array of any dimension to the n-dimension array input of the Replace
• Array Subset function.
• The function automatically resizes based on the dimensions of the array.
• The index input specifies which element, row, column to replace.
• The new element/subarray input specifies the value you want to replace an element.
• Resize the Replace Array Subset function to replace another element, row, column
within an array
• Run the VI

Deleting Elements within Arrays


• One can delete an element within a 1D array and a row or column within a 2D.
• To delete an element in a 1D array, right-click the array element on the front panel and
select Data Operations » Delete Element.
• To delete a row or column in a 2D array, right-click the array row or column on the front
panel and select Data Operations » Delete Row or Delete Column
• Can delete elements, rows, columns and pages within array using the Delete From Array
function.

Dept Of ECE 32
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

PROCEDURE:
Step 1: Create blank VI.
Step 2: Right click on the Block diagram panel →array→ max & min.
Step 3: Right click on the max & min (input side) →create →control.
Step 4: Create four numeric indicators in the front panel for maximum variable, index,
minimum variable, and index by right clicking on output side of max & min.
Step 5: Using wiring operations required connections are made as given in the block diagram.
Step 6: Inputs are given in the front panel and the program is executed.

BLOCK DIAGRAM:
Fig 8.1 shows the block diagram of array maximum and minimum in LabVIEW. Array input
R A G H U N A T H

is taken and using the array max and min function values are indicated using the indicators.

Fig 8.1: Block diagram of array maximum and minimum in LabVIEW

Dept Of ECE 33
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

OUTPUT /FRONT PANEL :


R A G H U N A T H

Fig 8.2: Input and output of array maximum and minimum

RESULT:
Fig 8.2 shows the maximum and minimum of given input array. The array maximum and
minimum is determined using LabVIEW and also its index.

VIVA QUESTIONS:
1. What is array? How it can be assigned?
2. Distinguish Array and Clusters.
3. How do graphs are made in VI?
4. Mention the difference between graph and charts.

Dept Of ECE 34
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

DEMONSTRATION EXPERIMENTS
EXPERIMENT 9
BUILD A VI THAT SIMULATES A HEATING AND COOLING
SYSTEM.THE SYSTEM MUST BE ABLE TO BE
CONTROLLED MANUALLY OR AUTOMATICALLY.

AIM:
To build a vi that simulates a heating and cooling system.The system must be able to be
controlled manually or automatically.
The VI’s specifications are listed below.

• Must be able to be controlled automatically or manually


R A G H U N A T H

• In manual mode, the heater and air conditioning (AC) can be switched on/off by the
user
• In automatic mode, the heater and AC turn on/off based on the following conditions:
o The air conditioner is turned on when the temperature is above 80°F
o The heater is turned on when the temperature is below 60°F
o The heater and the air conditioner are turned off when the temperature is between
60°F and 80°F.

THEORY:

Structures are process control elements, such as while loops and for loops. The structure to be
used in this experiment is the case structure which is essentially multiple if-statements. A case
structure contains multiple subdiagrams (or cases), and a case will be executed depending on
the input to the case structure

PROCEDURE:
1. In the front panel, drag and drop three Round LEDs and three Slide Switches by going to
the Controls palette > Modern tab > Boolean. Each round LED and each slide switch will
represent the AC, heater, and manual mode. The round LEDs will indicate if the item is on,
and the slide switches will toggle the items on/off.

2. Rename the LEDs and their corresponding switches "Manual," "AC," and "Heater" to make
building the system clearer. This can be done by using the editing text tool in the Tools
palette.

3. Drag and drop a thermometer into the front panel (Controls palette > Modern tab > Numeric
> Thermometer).

4. In the back panel, right click the thermometer terminal and select Change to Control, and
observe how the arrow switches from the left side to the right side. This makes the

Dept Of ECE 35
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

thermometer a control that will give an input to the program, which in this case is
temperature.

5. In the back panel, insert a case structure to control the manual and automatic operation of
the heating and cooling system (Functions palette > Structures > Case Structure). To place
the case structure, click once to place one corner of the case structure, and once more to
place the other corner of the case structure.

6. Wire the slide switch designated as Manual to the case selector on the case structure. This
should automatically change the selector label values to True and False, if they were not
already, because the slide switch is a Boolean data type. The true value corresponds to
manual mode being on (where the user can directly toggle the heater and AC), while the
false value corresponds to manual mode being off (where the heater and AC are
automatically toggled by the system).

7. Because the temperature of the room is input into the system only when the system is not in
manual mode (the false case), the thermometer terminal should be moved into the false sub-
R A G H U N A T H

diagram.

8. In the true sub-diagram, wire the AC and heater switches directly to their corresponding
LEDs. This allows the switches to directly toggle their corresponding LEDs.

9. Staying in the true sub diagram, insert a True Constant (Functions palette > Programming
tab > Boolean > True Constant). Wire the true constant to the manual LED to turn the
manual LED on and indicate that the system is in manual mode.

10. In the false sub diagram, insert two Numeric Constants (Functions palette >
Programming > Numeric > Numeric Constant), one Greater? function and one Less?
function (Functions palette > Programming > Comparison). These will be used to build the
program for the heating and cooling system in automatic mode.

11. The less and greater functions compare what is wired to the upper input terminal to
what is wired to the lower input terminal. Wire the thermometer to the upper input terminals
of the less and greater functions. Set a numeric constant to 60 and the other to 80. Wire the
60 numeric constant to the lower input terminal of the less function and the 80 numeric
constant to the lower input terminal of the greater function. Wire the output terminal of the
greater function to the AC LED and wire the output of the less function to the heater LED.

12. In the false sub diagram, Insert a False Constant (Functions palette > Programming >
Boolean > False Constant) and wire it to the manual LED. This is to turn off the manual
LED and indicate that the system is in automatic mode.

13. The system is now complete. Click the continuously run button to control and test the
VI. If the continuously run button is faded out, that means the system is wired completely.
When successfully running the system, the gridlines in the background of the front panel
should disappear. Click the switches and thermometer on the front panel to test the system.

Dept Of ECE 36
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

BLOCK DIAGRAM:
Fig 9.1 and 9.2 shows the block diagram for true case and false case respectively.
R A G H U N A T H

Fig .9.1 Block Diagram – For True Case

Dept Of ECE 37
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

Fig 9.2. Block Diagram – For False Case

OUTPUT/FRONT PANEL:
The output for VI simulating a heating and cooling system is shown in Fig 9.3.

Fig 9.3.output

RESULT:
A virtual instrument that simulates a heating and cooling system is built.

Dept Of ECE 38
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

VIVA QUESTIONS:
1. Design a temperature-controlled kettle for heating water and freezing water.
2. What are the temperature indicators in LabView?
3. What are True and False constant in LabView?
4. What is a if Block in LabView ?
R A G H U N A T H

Dept Of ECE 39
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 10
BUILD A VIRTUAL INSTRUMENT THAT SIMULATES
BASIC CALCULATOR USING FORMULA MODE

AIM :
To build a Virtual Instrument that simulates basic Calculator Using Formula Mode.

THEORY:
The Formula Node in LabVIEW software is a convenient, text-based node you can use to
perform complicated mathematical operations on a block diagram using the C- syntax structure.
It is most useful for equations that have many variables or are otherwise complicated. The text-
based code simplifies the block diagram and increases its readability. Furthermore, you can
R A G H U N A T H

copy and paste existing code directly into the Formula Node rather than recreating it
graphically. The Formula Node is available in all development versions of LabVIEW and does
not require an additional toolkit or add-on.

PROCEDURE:
The Formula Node in LabVIEW software is a convenient, text-based node you can use to
perform complicated mathematical operations on a block diagram using the C- syntax structure.
It is most useful for equations that have many variables or are otherwise complicated.
The text-based code simplifies the block diagram and increases its readability. Furthermore,
you can copy and paste existing code directly into the Formula Node rather than recreating it
graphically. The Formula Node is available in all development versions of LabVIEW and does
not require an additional toolkit or add-on.

This tutorial is useful for familiarizing yourself with the Formula Node. Follow the steps to
create a simple structure to compute different formulas depending on input values. Then,
compare the simplicity of your block diagram using a formula node to its counterpart using
graphical programming. The Formula Node is a tool that allows the benefits of text-based code
within the easy-to-use graphical LabVIEW architecture.

1. Selecting File»New VI to open a blank VI.


2. Place a Formula Node on the block diagram.
1. Right-click on the diagram and navigate
to Programming»Structures»Formula Node.
2. Left-click to select the Formula Node.
3. Place the Formula Node on the block diagram by left-clicking, dragging, and
releasing the mouse.
3. Right-click the border of the Formula Node and select Add Input from the shortcut
menu.
4. Label the input variable x.
5. Repeat steps 3 and 4 to add another input and label it y as in fig 10.1.

Dept Of ECE 40
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Fig.10.1 add input

5. Right-click the border of the Formula Node and select Add Output from the shortcut
menu as in fig 10.2.
R A G H U N A T H

Fig.10.2. add output

6. Label the output S1.


7. Repeat step 5 to create another output, and label this output D1

Fig.10.3 create output and label


Note: It is considered good programming practice to keep the inputs on the left border and the
outputs on the right border of the Formula Node. This helps you follow the data flow in your
VI and keep your code organized.

8. Enter the expressions below in the Formula Node.


▪ Make sure that you complete each command with a semicolon. Notice,
however, that the if-statement does not require a semicolon on the first line.

Dept Of ECE 41
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

1. Right-click on each input and select Create»Control from the shortcut menu.
2. Right-click on each output and select Create»Indicator from the shortcut
menu.
R A G H U N A T H

Dept Of ECE 42
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

BLOCK DIAGRAM :
The block diagram with formula node is shown in Fig 10.7.

Dept Of ECE 43
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

Fig 10.6 Block diagram


R A G H U N A T H

OUTPUT/FRONT PANEL:
The front panel view is shown in following fig 10.7.

Fig 10.7 output

RESULT:
A virtual instrument that simulates a basic calculator is built.
VIVA QUESTIONS:
1. What is the formula node?
2. Use formula node for finding area of circle, circumference of circle and arc of a circle
3. What is the advantage of using formula node?
4. Is formula node text based or block (graphical) based?

Dept Of ECE 44
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 11
WATER LEVEL INDICATOR

AIM:
To create and demonstrate water level indicator.
Description:
If No water is in tank then motor must be ON.
If water level crosses 8 then Motor must be OFF.

THEORY:
The water level indicator circuits are used in factories, chemical plants, and electrical substations and
R A G H U N A T H

in other liquid storage systems. There are many possible uses for this simple system, examples include
monitoring a sump pit (to control pump activation), rainfall detection, and leakage detection. Electronic
water level circuits have the capability of alerting if there is a water leak somewhere in the factory.
When the water level is too high or too low or exceeds the higher limit, it can detect the water level
easily by hearing an alarm sound or from different colors of a light bulb. We can also measure the fuel
level in motor vehicles and the liquid level containers which are huge in the companies.
The circuit is designed to indicate three levels of water stored in the tank: empty, half and full but not
overflowing. When there is no water in the tank, all the LEDs are off as an indication that the tank is
completely empty. Then, manually control the knob to turn ON LED. When water level increases and
touches the maximum limit, the OFF LED will glow indicating that there is water within the tank. As
the water level continues to rise and reaches half the tank, ON LED will still glow indicating tank is
filling.

The important LabVIEW components or tools, required to design a water level detector, list of
these components below:
• Tank

• Round Knob

• Upper Level Indicator

• Lower Level Indicator

• Numerical Indicator

• Graph to observe the results

Vertical pointer is used to control the level of the water in the tank. Upper level indicator shows
when the tank is about to completely fill. Lower level indicator shows indication by turning "ON"
the LED when the level of the water in the tank is too low and we need to fill it. Graphs shows the
graphical visualization as the vertical pointer moves up ow down.

Dept Of ECE 45
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

PROCEDURE:
Step 1: Create blank VI.
Step 2: Right click on the front panel →numeric→ knob.
Step 3: Right click on the knob →Properties→ scale→ Set maximum 10 and minimum 0
Step 4: Right click on the front panel →Boolean→ Round LED (Name it ON).
Step 5: Right click on the front panel →Boolean→ Round LED (Name it OFF).
Step 6: Right click on the front panel →numeric→ Numeric control
Step 7: Right click on the front panel →numeric→ Tank
Step 8: Right click on the Block diagram panel →comparison→ greater or equal?
Step 9: Right click on the Block diagram panel →comparison→ less?
R A G H U N A T H

Step 10: Right click on the Block diagram panel → numeric→ Numeric constant (set 8) [twice]
Step 11: Using wiring operations required connections are made as given in the block diagram.
Step 5: Execute- give inputs in the front panel by rotating knob and observe tank filling and
switches ON & OFF.

BLOCK DIAGRAM:
Fig 11.1 shows the block diagram water level indicator in LabVIEW. A round control knob is
used to switch on the motor and off. Numeric indicator display water level in tank.

Fig.11.1 block diagram

Dept Of ECE 46
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

OUTPUT /FRONT PANEL :


R A G H U N A T H

RESULT:
Fig 11.2 (a), (b) and (c) shows Motor on with no water and filling and reached upper limit and
off. A VI that indicates water level is built.

VIVA QUESTIONS:
1. How to create vertical indicators?
2. Is it possible to change the settings of LED?
3. Is it possible to implement this using While loop?
4. Comparator functions are present in which palette?

Dept Of ECE 47
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

EXPERIMENT 12
CALCULATION OF AREA AND PERIMETER OF CIRCLE

AIM:
To calculate area and perimeter of a circle.
Description: Area of circle = 𝜋𝑟2
Perimeter/circumference of circle = 2𝜋𝑟
r- radius of circle
if r>10 then indicate to reduce radius.
THEORY:
R A G H U N A T H

The area shows the space inside an object having two dimensions. Where as, circumference is
the parameter which shows the boundary of the object. Area is usually measured in m² and
circumference is measured in m according to their System International (SI) units. In this area
and area and circumference calculation of circle is achieved. In this LabVIEW program, which
will take radius as an input and calculates the area and circumference of circle, You can also
select the maximum limit of the radius. When the radius approaches its maximum limit an LED
will glow showing the notification reduce the radius.

PROCEDURE:
Step 1: Create blank VI.
Step 2: Right click on the front panel → numeric→ Numeric control
Step 3: Right click on the front panel → numeric→ Numeric indicator [Name Area]
Step 4: Right click on the front panel → numeric→ Numeric indicator [Name Circumference]
Step 5: Right click on the front panel → Boolean→ Square LED
Step 6: Right click on the Block diagram panel →Numeric→ multiply (thrice)
Step 7: Right click on the Block diagram panel →structures→ while loop
Step 8: Right click on the Block diagram panel →numeric→ numeric constant [set value 10]
Step 9: Right click on the Block diagram panel →numeric→ numeric constant [set value 2]
Step 10: Right click on the Block diagram panel →numeric→ math constants→pi
Step 11: Using wiring operations required connections are made as given in the block diagram

Dept Of ECE 48
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab

BLOCK DIAGRAM:
Fig 12.1 shows the block diagram of area and circumference of circle in LabVIEW. Area and
circumference is calculated using formulas. An upper limit to radius is also kept here.
R A G H U N A T H

Fig.12.1 block diargram

OUTPUT /FRONT PANEL :

RESULT:

VIVA QUESTIONS:
1. What are the units of area and perimeter?
2. Where to select pi function?
3. What is the difference between continuous run and run?
4.How to indicate broken wire in LabVIEW?

Dept Of ECE 49
LabVIEW programming Basics Lab manual 18EC384 Ability Enhancement Lab
R A G H U N A T H

Dept Of ECE 50

You might also like