J Component: Measurement and Instrumentation

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

MEASUREMENT AND INSTRUMENTATION

(EEE2004)

REVIEW-3
J COMPONENT

“INTRODUCTION TO LABVIEW”

NAME: NIRBHI JAIN


REG.NO.: 19BEE0277
1
INDEX

S.NO. TITLE PAGE NO.

1 INTRODUCTION TO LABVIEW 3

2 BENEFITS 4

3 LABVIEW PROGRAMMING BASICS 5

4 BASIC OPERATIONS 6

5 FOR LOOP 10

6 WHILE LOOP 13

4 CASE STRUCTURES 15

5 CONCLUSIONS 19

6 REFERENCES 20

2
INTRODUCTION TO LABVIEW

Laboratory Virtual Instrument Engineering Workbench (LabVIEW) is a system-design


platform and development environment for a visual programming language from National
Instruments.

• LabVIEW is the acronym for Laboratory Virtual Instrument Engineering Workbench

• It is a Graphical-based programming language

• VI (Virtual Instrument) is the basic LabVIEW element

• Programming languages such as C, C++, BASIC use functions and subroutines LabVIEW
uses VI

LabVIEW has the flexibility of a programming language combined with built-in tools
designed specifically for test, measurement, and control, you can create applications
that range from simple temperature monitoring to sophisticated simulation and control
systems.

3
BENEFITS

• Graphical user interface: Design professionals use the drag-and-drop user interface library
by interactively customizing the hundreds of built-in user objects on the control’s palette.

• Drag-and-drop built-in functions: Thousands of built-in functions and IP including


analysis and I/O, from the functions palette to create applications easily.

• Modular design and hierarchical design: Run modular LabVIEW VIs by themselves or
as subVIs and easily scale and modularize programs depending on the application.

• Multiple high-level development tools: Develop faster with application specific


development tools, including the LabVIEW State chart Module, LabVIEW Control Design
and Simulation Module and LabVIEW FPGA Module.

• Professional Development Tools: Manage large, professional applications and tightly


integrated project management tools; integrated graphical debugging tools; and standardized
source code control integration.

• Multi platforms: The majority of computer systems use the Microsoft Windows operating
system. LabVIEW works on other platforms like Mac OS, Sun Solaris and Linux. LabVIEW
applications are portable across platforms.

• Reduces cost and preserves investment: A single computer equipped with LabVIEW is
used for countless applications and purposes—it is a versatile product. Complete
instrumentation libraries can be created for less than the cost of a single traditional,
commercial instrument.

4
LabVIEW PROGRAMMING BASICS
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, you build a user interface by using a set of tools and objects.
The user interface is known as the front panel. You then add code 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 called 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.
• Block diagram — Contains the graphical source code that defines the
functionality of the VI.
• Icon and connector pane — Identifies the VI so that you can use the VI in
another VI. A VI within another VI is called a subVI. A subVI corresponds to
a subroutine in text based programming languages.

5
BASIC OPERATIONS

Fig. 1: ADDITION

STEPS:
• Use block diagram panel to program
• Use Right click to get codes
• Follow Right click -Numeric-Add
• Place the Addition tool where we want
• Then Right click at node of input to addition tool
• Create Control at enter input
• Now create indicator by using right click at the output node at addition
pin
• Check whether the program is correct or wrong
• Run continuously if program is correct otherwise check the program
• Use Front panel to RUN...
• Enter inputs in the front panel

6
Fig. 2: SUBTRACTION

STEPS:

• Use block diagram panel to program


• Use Right click to get codes
• Follow Right click -Numeric-Subtract
• Place the Subtraction tool where we want
• Then Right click at node of input to subtraction tool
• Create Control at enter input
• Now create indicator by using right click at the output node at
subtraction pin
• Check whether the program is correct or wrong
• Run continuously if program is correct otherwise check the program
• Use Front panel to RUN...
• Enter inputs in the front panel

7
Fig. 3: MULTIPLICATION

STEPS:
• Use block diagram panel to program
• Use Right click to get codes
• Follow Right click -Numeric- Multiply
• Place the Multiplication tool where we want
• Then Right click at node of input to multiplication tool
• Create Control at enter input
• Now create indicator by using right click at the output node at
multiplication pin
• Check whether the program is correct or wrong
• Run continuously if program is correct otherwise check the program
• Use Front panel to RUN...
• Enter inputs in the front panel

8
Fig. 4: DIVISION

STEPS:

• Use block diagram panel to program


• Use Right click to get codes
• Follow Right click -Numeric- Divide
• Place the Division tool where we want
• Then Right click at node of input to division tool
• Create Control at enter input
• Now create indicator by using right click at the output node at division
pin
• Check whether the program is correct or wrong
• Run continuously if program is correct otherwise check the program
• Use Front panel to RUN...
• Enter inputs in the front panel

9
USING LOOPS

FOR LOOP

• To place a for loop select it from Functions Palette » Structures then


click and drag on the block diagram to draw a box.

• The Count Terminal determines how many times the code inside the
loop will execute.

• The Count is tested before each iteration of the loop. Therefore it is


possible that the code inside the loop may never execute (if the count is
less than or equal to 0).

• The Iteration Terminal provides the current loop count starting with
zero.

• By default for loops execute as quickly as possible. Use the Wait


(ms) or a similar primitive to control execution speed.

• Multiple for loops will be distributed across multiple CPU


cores automatically.

10
EXAMPLE (1):
Sum of ‘N’ natural numbers using FOR Loop

Fig 5: SUM OF FIRST 3 NATURAL NUMBERS

Fig 6: SUM OF FIRST 10 NATURAL NUMBERS

11
EXAMPLE (2):
Calculate Factorial of numbers using FOR Loop

Fig 7: FACTORIAL OF FIRST 3 NUMBERS

Fig 8: FACTORIAL OF FIRST 5 NUMBERS

12
WHILE LOOP

• To place a while loop select it from Functions Palette »


Structures then click and drag on the block diagram to draw a box.

• The Condition Terminal is used to exit the loop when the specified
condition is met.

• The conditional terminal is tested at the end of each loop


iteration. Therefor while loops always execute at least once.

• By default a True value passed to the conditional terminal will


terminate the loop.

• The Iteration Terminal provides the current loop count starting with
zero.

• By default while loops execute as quickly as possible. Use the Wait


(ms) or a similar primitive to control execution speed.

• Multiple while loops will be distributed across multiple CPU


cores automatically.

13
EXAMPLE (1):
Sum of N numbers using WHILE Loop

Fig 9: Sum of First 3 natural numbers

Fig 10: Sum of First 5 natural numbers

14
CASE STRUCTURES IN LABVIEW

A Case structure has two or more sub diagrams, or cases.

Only one sub diagram is visible at a time, and the structure executes only
one case at a time. An input value determines which sub diagram executes.
The Case structure is similar to switch statements or if...then...else statements
in text-based programming languages.

In LabView, the conditional statements used are said as case


structures. They work in the same way as other conditional statements do.

You can add infinite number of conditions in your code and can easily

execute selective statements of your code using case structures in LabView.

15
STEPS:

• To place a case structure, select it from Functions Palette»


Structures then click and drag on the block diagram to draw a box.
• Case structures contain sub diagrams or cases.
• The value passed into the Case Selector terminal determines which
case executes.
• By default the case selector is a Boolean data type and two cases
exist True and False
• Connecting another data type to the case selector will
automatically change it's data type.
• The Selector Label indicates the condition associated with each sub
diagram.
• Left click the selector label to change the condition associated
with a sub diagram.
• Add or remove sub diagrams by right clicking the edge of the case
structure or selector label.
• Data is passed into and out of the case structure using tunnels which
are automatically created when data is wired into or out of the case
structure.

16
EXAMPLE 1:
To declare that Boolean expression is TRUE or FALSE

Fig 11: To find that the expression is TRUE

Fig 12: To find that the expression is FALSE

17
EXAMPLE 2:

Fig.13
3

Fig.14

Fig.13 &14 justify the use of Two Inputs and one Case Input in order to get
an Output

18
CONCLUSION
National Instruments LabVIEW and the integrated analysis functions it
provides, make up a powerful graphical application development
environment designed specifically for engineers and scientists. LabVIEW
provides solutions regardless of industry or area of focus within the
engineering process, from design and validation to production.

In addition, LabVIEW offers unparalleled connectivity to plug-in DAQ


devices and stand-alone instruments for acquiring data. LabVIEW provides
powerful analysis libraries, routines, and algorithms that range from basic
math to advanced signal processing, for both general-purpose applications as
well as more vertical needs, which can be seamlessly integrated with all
other functions in LabVIEW. These functions, in conjunction with powerful
data visualization capabilities, make LabVIEW the ideal tool for any
application.

19
REFERENCES

• https://k12lab-support-pages.s3.amazonaws.com/lvbasichome8.html
• https://www.ni.com/en-in/support/documentation/supplemental/08/labview-for-loops-
and-while-loops-explained.html
• https://www.halvorsen.blog/documents/teaching/courses/labview_automation/labview
_basic.php

20

You might also like