AEC-Manual
AEC-Manual
R N SHETTY TRUST®
III Semester
BEC358A
AEC-Labview Programming Basics BEC358A III Sem ECE
To impart high quality education in Engineering, Technology and Management with a difference, enabling
students to excel in their career by
1. Attracting quality Students and preparing them with a strong foundation in fundamentals so as to
achieve distinctions in various walks of life leading to outstanding contributions.
2. Imparting value based, need based, and choice based and skill based professional education to the
aspiring youth and carving them into disciplined, World class Professionals with social responsibility.
3. Promoting excellence in Teaching, Research and Consultancy that galvanizes academic
consciousness among Faculty and Students.
4. Exposing Students to emerging frontiers of knowledge in various domains and make them suitable for
Industry, Entrepreneurship, Higher studies, and Research & Development.
5. Providing freedom of action and choice for all the Stake holders with better visibility.
1. To achieve and foster excellence in core Electronics and Communication engineering with focus on the
hardware, simulation and design.
2. To pursue Research, development and consultancy to achieve self sustenance.
3. To create benchmark standards in electronics and communication engineering by active involvement of
all stakeholders.
AEC-Labview Programming Basics BEC358A III Sem ECE
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 the 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.
CO3 Use the programming structures and data types that exist in Lab VIEW
CO mapping to PO/PSOs
CO / PO & PSO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
21EC384.1 2 2 1 2
21EC384.2 2 1 2 1 2
21EC384.3 2 1 2 1 2
21EC384.4 2 1 1 2 1 1 2
LIST OF EXPERIMENTS
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.
12 Demonstrate how to create basic VI which calculates area and perimeter of a circle.
Dept. Of ECE 6
Assessment Details (both CIE and SEE)
The weightage of Continuous Internal Evaluation (CIE) is 50% and for Semester End Exam (SEE) is 50%.
The minimum passing mark for the CIE is 40% of the maximum marks (20 marks out of 50) and for the
SEE minimum passing mark is 35% of the maximum marks (18 out of 50 marks). A student shall be deemed
to have satisfied the academic requirements and earned the credits allotted to each subject/ course if the
student secures a minimum of 40% (40 marks out of 100) in the sum total of the CIE (Continuous Internal
Evaluation) and SEE (Semester End Examination) taken together.
Continuous Internal Evaluation (CIE): CIE marks for the practical course are 50 Marks. The split-up of CIE
marks for record/ journal and test are in the ratio 60:40. Each experiment is to be evaluated for conduction
with an observation sheet and record write-up. Rubrics for the evaluation of the journal/write-up for
hardware/software experiments are designed by the faculty who is handling the laboratory session and are
made known to students at the beginning of the practical session.
Record should contain all the specified experiments in the syllabus and each experiment write-up will be
evaluated for 10 marks. Total marks scored by the students are scaled down to 30 marks (60% of maximum
marks). Weightage to be given for neatness and submission of record/write-up on time. Department shall
conduct a test of 100 marks after the completion of all the experiments listed in the syllabus. In a test, test
write-up, conduction of experiment, acceptable result, and procedural knowledge will carry a weightage of
60% and the rest 40% for viva-voce. The suitable rubrics can be designed to evaluate each student’s
performance and learning ability. The marks scored shall be scaled down to 20 marks (40% of the maximum
marks). The Sum of scaled-down marks scored in the report write-up/journal and marks of a test is the total
CIE marks scored by the student.
Dept. Of ECE 7
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.
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 sub VI. A sub VI corresponds to a subroutine in text-
basedprogramming languages. Fig 2 shows Block diagram of VI programming.
Dept. Of ECE 8
Fig 1. Front Panel 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 9
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.
Dept. Of ECE 10
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 11
Fig 5: LabVIEW Windows
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 12
– 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
– <Ctrl+B> to delete all broken wires or right click and select Clean Up Wire to reroute
the wire.
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 13
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.
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 14
BLOCK DIAGRAM:
The block diagram for basic arithmetic operations using LabVIEW is shown below in Fig.1.1.
OUTPUT/FRONT PANEL:
Output of basic arithmetic operations is shown in below fig 1.2.
Dept. Of ECE 15
RESULT:
The arithmetic operations were performed and the result is verified using LabVIEW.
Viva questions:
1. What are the advantages of LabVIEW?
3. What is the difference between local variable and global variable in LabVIEW?
Dept. Of ECE 16
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.
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 17
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.
OUTPUT/FRONT PANEL:
The output of Boolean operations is shown below in Fig.2.3.
Dept. Of ECE 18
Fig.2.3: output of Boolean operations
RESULT:
The Boolean operation using LabVIEW is performed.
VIVA QUESTIONS:
1. Is LabVIEW a compiled programming language?
3.What is LabVIEW?
Dept. Of ECE 19
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.
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 20
BLOCK DIAGRAM:
The block diagram of sum of n numbers using FOR loop is shown in Fig 3.2 below.
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.
Dept. Of ECE 21
Fig 3.3: result of sum of n numbers using FOR loop
RESULT:
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?
Dept. Of ECE 22
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.
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.
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 23
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
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.
Dept. Of ECE 24
OUTPUT/FRONT PANEL:
The output of factorial of a number using FOR loop is shown below in Fig.4.3.
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 25
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:
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 26
OUTPUT/FRONT PANEL:
The output or the front panel window is shown below in fig 5.2.
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 27
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
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 28
BLOCK DIAGRAM :
Dept. Of ECE 29
OUTPUT/FRONT PANEL:
The output or the front panel window view is shown below in fig 6.3.
Fig.6.3 output
RESULT:
Factorial of a number is determined using while loop in LabVIEW.
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 30
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
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.
Dept. Of ECE 31
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.
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 32
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.
Input
Output
RESULT:
Fig 7.3 shows the input array and sorted array. Even numbers are sorted using while loop in an
array.
Dept. Of ECE 33
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?
Dept. Of ECE 34
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
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
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.
Dept. Of ECE 35
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.
Dept. Of ECE 36
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
is taken and using the array max and min function values are indicated using the indicators.
Dept. Of ECE 37
OUTPUT /FRONT PANEL :
Input
Output
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 38
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.
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 39
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-
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 40
BLOCK DIAGRAM:
Fig 9.1 and 9.2 shows the block diagram for true case and false case respectively.
Dept. Of ECE 41
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 42
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 ?
Dept. Of ECE 43
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
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.
Dept. Of ECE 44
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.
Dept. Of ECE 45
if (x*y>0)
z1 = 3*x**2 - 2*y**3;
else z1 = 0;
z2 = sinh(z1);
Note that you can change the control and indicator names to their respective variable by editing
their labels as in Fig 10.4.
10. Place a While Loop around the Formula Node and the controls.
1. Right-click on the diagram and navigate to Programming»Structures»While
Loop.
2. Left-click to select the While Loop.
3. Place the While Loop on the block diagram by left-clicking, dragging, and
releasing the mouse.
4. Right-click the Stop icon and Create Control. Label it as Stop.
11. Add a Wait (ms) function inside of the While Loop to conserve memory usage, and
wire in 100 milliseconds as a wait time. Your block diagram should appear as follows
in Fig 10.5.
Dept. Of ECE 46
Fig.10.5 while loop
11. Click the Run button to run the VI. Change the values of the input controls to
12. see how the outputs change.
In this case, the Formula Node helps minimize the space required on the block diagram.
Accomplishing the same task without the use of a Formula Node requires the following code
as in Fig 10.6.
BLOCK DIAGRAM :
The block diagram with formula node is shown in Fig 10.7.
Dept. Of ECE 47
Fig 10.6 Block diagram
OUTPUT/FRONT PANEL:
The front panel view is shown in following fig 10.7.
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 48
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
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
Numerical Indicator
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 49
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?
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.
Dept. Of ECE 50
OUTPUT /FRONT PANEL :
Fig 11.2 (a): Motor is on- (no water) Fig 11.2 (b): Motor is on- (water in tank)
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 51
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:
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 52
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.
Fig 12.2 (a): Radius is < 10- (Reduce radius is OFF) Fig 12.2 (b): Radius is > 10- (Reduce
radius is ON)
RESULT:
Fig 12.2 (a) shows area and circumference of circle and indication of Radius is < 10- (Reduce
radius is OFF). Fig 12.2 (b) shows Radius is > 10- (Reduce radius is ON). A VI which
calculates area and perimeter of a circle is created and demonstrated.
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 53
Dept. Of ECE 54
Dept. Of ECE 55
Dept. Of ECE 56
Dept. Of ECE 57
Dept. Of ECE 58