0% found this document useful (0 votes)
90 views92 pages

Labview RM

This document discusses LabVIEW Basics and Hardware Interfacing. It provides an overview of what is needed to get started with LabVIEW, including manuals, software, hardware devices, and cables. Academic development stages and debugging tools are also outlined. The document then discusses how LabVIEW plays a role in hardware connections and integration. It provides information on National Instruments and the diversity of applications where LabVIEW can be used.

Uploaded by

Panku Rangaree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views92 pages

Labview RM

This document discusses LabVIEW Basics and Hardware Interfacing. It provides an overview of what is needed to get started with LabVIEW, including manuals, software, hardware devices, and cables. Academic development stages and debugging tools are also outlined. The document then discusses how LabVIEW plays a role in hardware connections and integration. It provides information on National Instruments and the diversity of applications where LabVIEW can be used.

Uploaded by

Panku Rangaree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 92

Department of Electronics Engineering

LabVIEW Basics and Hardware Interfacing

Presented By
Prof. Bharati B. Sayankar
What You Need To Get
Started

• LabVIEW Basics I Course Manual


• LabVIEW Basics I Course CD
• Multifunction DAQ device
• GPIB interface
• DAQ Signal Accessory, wires, and cable
• NI Instrument Simulator and power supply
• Serial and GPIB cables

Computer running
LabVIEW 8.5 or later
and Windows 2000 or later
Academic Development Stages

1. Define the problem (Scenario)


2. Design an algorithm or flowchart
3. Simulate the design

1. Test and verify the implementation


2. Maintain and update the implementation
Reasons
Debugging Tools
(Emulator)

1.Platform Requirements
Cross-Compiler
Language
Target Board
Emulator

2. Testing & Debugging Tools


Spectrum Analyzer Bode Analyzer
Function generator

Multiple Scope
How LabVIEW Play Role?
5

Hardware Connections

SC-2075
BNC-2120

NI-ELVIS
SCB-68
How LabVIEW Play Role?
6

NI ELVIS: Educational Design and Prototyping Platform


1.Integrates the 12 most commonly used
instruments – including Oscilloscope,
Digital multimeter,
Function generator,
Bode analyzer, and more – into a

Ideal for the lab or classroom.


It connects to your PC through USB
connection, providing quick and easy
acquisition and display of measurements.

Based on NI LabVIEW graphical system design


software, NI ELVIS offers the flexibility of virtual
instrumentation
National Instruments
7

Leader in data acquisition technology with innovative modular 


Corporate headquarters in Austin, TX
instruments and LabVIEW graphical programming software  More than 40 international branches


5,100 employees

More than 1,000 products

600 Alliance Partners

Fortune’s 100 Best


Companies to Work For
Twelve Consecutive
Years

Dr. James Truchard


Diversity of Applications
8
No Industry > 10% of Revenue

Telecom Automotive Semiconductors Electronics Computers

Advanced Food
ATE Military/Aerospace Research Petrochemical Processing Textiles
9
How does LabVIEW work?
 LabVIEW programs are called:
 Virtual Instruments (VIs)
 because their appearance and
operation imitate actual instruments.
 However, they are analogous to main programs,
functions and subroutines from popular language
like C, Fortran, Pascal, …
The G Language:
10

• Completely graphical programming language.


• Source code is a diagram of nodes and wires.

• Data travels along wires.

• Flow of data controls execution. Not flow of code!


• Position on diagram is irrelevant.
• Being an expert in C can be a disadvantage…
A New Way of Thinking:
11

Dataflow NOT Codeflow


UnlockCAL(HeaterMat);

GetTempCAL(HeaterMat);

SetTempCAL(HeaterMat);

LockCAL(HeaterMat);

Guiding Principle:
A node does not run until
data sits at all its wired inputs.

Data Dependency
Why use LabVIEW?
• Easy to Learn - Intuitive.
12
• Easy to Use.
• No Syntax.
• Source code reads like schematic.
• Speed of development.
• Ready made controls for many instruments.
• Support.
• Easy and instant debugging.
• Power – Instant Parallel threads.
• No memory concerns. (Within Reason)
• As versatile as text-based languages.
Session Topics
13


What is LabVIEW?

LabVIEW Environment

LabVIEW Project

Parts of a VI

Menus & Palettes

Configurations


LabVIEW Data Types

LabVIEW Data Flow
Open and Run LabVIEW
14

Start»All Programs»National Instruments LabVIEW 2012

Start from a blank VI:


File>>New VI

Start from an example:


Help»Find Examples…

Open Existing:
-VI
-Project
What is a Virtual Instrument (VI)?
15

Answer: a LabVIEW program


1. Front Panel * Conn. pane
available from FP
User interface (UI) only


Controls = inputs

Indicators = outputs

2. Block Diagram
Graphical source code

Data travels on wires from control terminals through
functions to indicator terminals

Blocks execute by data flow

3. Icon/Connector Pane

Graphical representation of a VI

Means of connecting VIs (subVIs)
Example 5: Creating Sub-VIs

 In wiring diagram use selection


tool (mouse box) to select all
items to be in the SubVI.
 From Edit menu select “Create
SubVI”
 Double click on new icon and
save it as a separate VI.
 Cut-and-paste it at will or insert
it using “Functions – Select VI
menu”
A Closer Look
We’ve covered most of the basics of the
environment. Now lets look at methods and
techniques of programming.
• Structures
• Built In Functions
• User Vi’s
• Clusters
• Programming Tips
Structures:
How you control data flow
• Case Structure
• While Loop (with shift registers)
• For Loop
• Sequence
• Formula Node
• Events Structure

Understanding the operation of these is vital.


Case:

• Similar to the Case statement in C


• Contains one or more frames.
• The frame that executes depends on what is
wired to the selection terminal.
• Many data types can be wired to the selector.
• Lets see it in LabVIEW:
While:

• Similar to the While statement in C


• Contains one frame that is repeated
• Test for continuance is performed after
execution so frame always executes once.
• “i” terminal gives number of current iteration
(first frame is 0)
• “stop” terminal can be “continue if true” or
“stop if true” selected from context menu.
Shift Registers:

• Selected via right-clicking the frame.


• Enables the result of an iteration to be passed to the next
iteration.
• Can be used for any data type
• The results of older iterations can be accessed by making
the left terminal larger.
• The initial value is set by wiring to the left terminal and
the final iterations value is output at the right terminal.
• Results are kept between runs of a vi.
For Loop:

• Similar to the while loop but is executed a set


number of times (wired to the N terminal)
• If 0 is wired to the terminal the frame does not
run, do outputs will be invalid.
• Input arrays can be indexed automatically and
if N is not wired the number of iterations will be
the size of the largest input array.
• Shift registers can also be used here.
Sequence:

• Used to order events where no data


dependency exists.
• Can have more than one frame but this should
ALWAYS be avoided. (Like goto in C)
Formula Node:

• Used to avoid large numbers of arithmetic


functions
• Has one or more inputs and outputs
• Uses C type syntax
Event Structure:

• Handles windows events


• Used for customisation of user interface
• Allows very fancy tricks!
• LabVIEW 6.1 only
Built in Functions:
Over 100 built in functions

Use the context help window to find what you


need.
Built in Functions:
Low Level
• Boolean Logic
• Arithmetic
• Comparisons
These functions accept different data types and
often arrays can be directly wired.

Mid Level
• Array Manipulation (Transpose, interpolate,
subset...)
• String Manipulation (Search, format,
replace...)
• Time and Date
Built in Functions:
High Level
• File I/O
• Device communication (GPIB, serial etc…)
• Network communication (TCP, UDP, IrDA)
• Waveform manipulation (FFT, Filters, Analysis)
• Math
• Sound and Graphics
• Program Control
• Advanced: Semaphores, Queues,
Occurrences.

So check before you build your own


User Vi’s:
For often used routines or to prevent an excess
of code on your diagram create a user vi
• Create the vi as if it were a stand alone
program
• Right click the icon to access the wiring and
icon menu.
• “Show connector” and select a pattern of
terminals and then use the wiring tool to select
controls and indicators to be terminals.
• Edit the icon
• Place the vi where you need it using “select a
vi”see
Lets off that
the function pallet.
in LabVIEW:
Clusters:
• Collection of one or more items of data
• Best used as “Named Clusters”

• In this way you can carry related data in one


wire and extract only the data you need when
you need it.
• Also reduces the need for many terminals in a
user vi.
Project Explorer
31

Use LabVIEW Projects to:


• Group LabVIEW files and non-LabVIEW files
• Create build specifications (i.e. stand-alone applications)
• Deploy or download files to targets (i.e. FPGA target)

31
32

Demonstration:
Creating a new VI
Front Panel Toolbar
33

It is best not to use the Abort button because you run the
risk of not closing references or cleaning up memory
correctly

Run Align Objects

Run Continuously Distribute Objects

Abort Resize Objects


Pause
Reorder
Text Settings
Context Help
Front Panel Controls and
Indicators
Numeric Boolean Customize
Palette View

String Right click!


Shortcut Menus and Properties Dialog
Right Click!
Block Diagram Toolbar
Front Panel

Resize Objects Context Help


Block Diagram

Run Step In Reorder

Run Continuously Step Over Clean Up Block Diagram

Abort Step Out

Text Settings
Pause
Align Objects
Highlight Execution
Distribute Objects
Retain Wire Values
Block Diagram
Terminals
• Block Diagram appearance of front
panel objects
• Entry & exit ports that exchange
information between the front panel
and block diagram
• Analogous to parameters and
constants in text- based programming
languages
Wires
• Transfer data between block diagram objects
DBL Integer
• Wires are different colors, styles, and Numeric Numeric
thicknesses, depending on data type String
• A broken wire appears as a dashed Scalar
black line with a red X in the middle 1D Array
2D Array
Types of Wire:
As terminals accept only defined data
types, so wires have defined types.
This is indicated by colour and style.
Usual data types:
• 8,16,32 bit Integers (Signed and
Unsigned)
• Single, Double and Extended floating
point
• Complex
• Boolean
• String
• Arrays
• Clusters (Combination of any above)
Block Diagram: Wiring Tips
• Press <Ctrl>-B to delete all broken wires
• Right-click and select Clean Up Wire to reroute the wire
• Use the Clean Up Diagram tool to reroute multiple wires and objects to
improve readability
Select a section of your block diagram
Click the Clean Up Diagram button on the block diagram toolbar (or <Ctrl>-U)

39
Block Diagram
Nodes
 Objects on the block diagram that have inputs and/or outputs and perform
operations when a VI runs
 Analogous to statements, operators, functions, and subroutines in text-based
programming languages

Functions subVIs Structures


• Fundamental operating elements • VI that you build to use inside • While loops, for loops,
of LabVIEW another VI event structures

• Do not have front panels or block • Any VI has potential to become a • More discussion later
diagrams, but do have connector subVI
panes
• Double-clicking a subVI will open it
• Double-clicking a function only (exception: Express Vis- config.
selects the function – does not window opens)
open it like a VI
• Icon represents subVI in main VI
• Has a pale yellow background on
its icon
Common Data Types Found in LabVIEW
Numeric Controls and Functions

 (Front Panel) From the


(Block Diagram) From the
Controls»Modern»Numeric
Functions»Programming»Numeric
subpalette, select the Numeric subpalette, select the Add icon.
Control icon.
Mathematical Operations
 (Block Diagram) From the Functions»Mathematics»Integration and
Differentiation subpalette, select the Derivative x(t).vi
Boolean Controls and Functions
 (Front Panel) From the (Block diagram) From the
Controls»Modern»Boolean Function»Programming»Boolean subpalette,
subpalette, select the Push select the OR icon.
Button icon.
String Controls and Functions
 (Front Panel) From the (Block diagram) From the
Controls»Modern»String Function»Programming»String subpalette,
subpalette, select the String select the Concatenate icon.
Control icon.
Demonstration :
Using the Functions and Controls Palette
Polymorphism
 Definition: a programming
language feature that allows
values of different data types
to be handled using a uniform
interface.
 In LabVIEW: the ability of VIs
and functions to
automatically adapt to accept
input data of different data
types

i.e. Numeric Functions
 Useful when performing the
same operation on different
data types
Data Flow

Block diagram execution is
dependent on the flow of data

Block diagram does NOT execute
left to right
 Node executes when data is
available to ALL input terminals

Nodes supply data to all output
terminals when done

If the computer running this
code had multiple processors,
these two pieces of code could
run independently without
additional coding
Creating a simple VI
Creating a VI - 1
Arithmetic Operation on Numerical data

Front Panel Window

Block Diagram Window

Control Indicator
Terminals Terminals
Creating a VI - 2
To find Square Root
Front Panel Window

Block Diagram Window

Control
Terminals

Indicator
Terminals
Creating a VI - 3
To Convert temp degree to F
Front Panel Window

Block Diagram Window

Control
Terminals

Indicator
Terminals
Creating a VI - 4
Convert Second into (Second ,Minute and hour)
Front Panel Window

Indicator
Terminals
Block Diagram Window

Control
Terminals
Creating a VI - 5
Random Number Generator
Front Panel Window

Block Diagram Window

Indicator
Terminals
Control
Terminals
Creating a VI - 6
String Selection & Display
Front Panel Window

Block Diagram Window

Indicator
Terminals
Control
Terminals
Creating a VI - 7
Compares of TEMP (MIN & MAX)
Front Panel Window

Block Diagram Window


Creating a Graphical VI

57
Creating a VI – G1
Interaction With Analog / Digital VI Object
Front Panel Window Block Diagram Window
Creating a VI – G2
OVER TEMP INDICATION
Front Panel Window Block Diagram Window
Creating a VI – G3
(frequency Generation) Interaction With Analog / Digital VI Object
Front Panel Window Block Diagram Window
Case Study-1
Study of frequency aliasing Effect
Front Panel Window
Programming

62
Example 1: Craps

 From the functions – numeric


panel insert a pair of dice
 From the Controls panel insert a
numeric digital indicator (on the
front panel)
 Use the wiring tool to connect
the two (in the wiring diagram)
and click the “run” button
repeatedly.
 Numbers from 0.00 to 1.00
should be displayed in the front
panel
Example 1: Craps (continued)

 Delete the wire


 Add a multiplication node and a
numeric constant to allow
multiplication by 5
 Add an addition node and
numeric constant to allow
addition of 1
 Add a mathematical “Round to
Nearest” node.
 Make a second copy of this
structure to represent a second
This wiring diagram simulates the rolling
of 2 dice and their addition to form a number
die and wire them together
from 2 through 12. through an addition node with
an output to a numeric constant
Example 2: Analog & Digital
Voltmeter (simulated signal)

 Uniform noise used as simulated signal –


Functions – Signal Processing – Signal
Generation menu
 Absolute value function from functions –
numeric menu
 Mean value of data series from the
functions – mathematics – Probability and
Statistics menu
 The 250 ms wait implemented from the
time and dialog menu slows the “flutter” of
the meter.
Example 3: Reading an analog input
signal
Requires A/D board to implement

 From the functions menu select


data acquisition and then analog
input. Then select either
“Sample Channel” or Sample
Channels”
 This places the sampling icon in
your wiring diagram
 You then need to configure the
channel(s) and wire the output
to other parts of your program.
Case study-1: Signal Analysis (continued)
NI cDAQ-9174
NI cDAQ-9174
(Hardware Interfacing)
FIG.1 NI-cDAQ-9174
FIG.1 NI-cDAQ-9174
Mounting the NI cDAQ-9174

1] NI-cDAQ -9174 chassis Includes two Metal feet


for Desktop Use. With this kit, you can tilt the NI
cDAQ-9174 chassis for convenient access to the I/O
module connectors.

2] Allows 25.4 mm (1 in.) of clearance above and


below the NI cDAQ-9174 chassis for air circulation.
Understanding LED Indications
Power LED

LED DEFINATION

GREEN Power Supplied

Off NO Power Supplied

Ready LED

LED DEFINATION

GREEN Power Supplied

Off NO Power Supplied


Active LED

LED DEFINATION
Power is applied, but USB connection is not
AMBER established

GREEN USB traffic present

Off No USB traffic present


NI cDAQ-9174

The cDAQ system consists of three parts:

1] C Series I/O modules

2] The cDAQ module interface

3] The USB-STC3.
C- Series Module

1] C Series I/O modules provide built-in signal


conditioning for extended voltage ranges or industrial
signal types.

2] C Series I/O modules are hot-swappable and


automatically detected by the NI cDAQ-9178/9174
chassis.

3] The C Series I/O modules provide isolation from


channel-to- earth ground.
cDAQ Module Interface

The cDAQ Module Interface manages data


transfers between the USB - STC3 and the C
Series I/O modules. The interface also handles
autodetection, signal routing, and
synchronization.
USB-STC3
The USB-STC3 provides independent features high-speed data
streams , flexible AI, AO, and DIO sample timing ,triggering , PFI
signals for multi-device synchronization; flexible counter/timers
with hardware gating , digital waveform acquisition and
generation; and static DIO.

1] AI, AO, and DIO Sample Timing

The USB-STC3 contains advanced AI, AO, and DIO timing


engines. A wide range of timing and synchronization signals are
available through the PFI lines.
2] Triggering Module

The NI cDAQ-9178/9174 supports different trigger modes, such as


start trigger, reference trigger, and pause trigger with analog,
digital, or software sources.
3] Independent Data Streams
The NI cDAQ-9178/9174 supports seven independent high-speed data
streams, allowing for up to seven simultaneous hardware timed tasks, such as
analog input, analog output, buffered counter/timers, and hardware-timed
digital input/output.

4] PFI signal
The PFI signals provide access to advanced features such as triggering,
synchronization, and counter/timers. PFI signals are available through hardware-
timed digital input and output modules installed in up to two chassis slots and
through the two PFI terminals provided on the NI cDAQ-9174 chassis.

5] Flexible counter / Timers


The NI cDAQ-9178/9174 includes four general-purpose 32-bit counter/timers
that can be used to count edges, measure pulse-widths, measure periods and
frequencies, and perform position measurements (encoding). In addition, the
counter/timers can generate pulses, pulse trains, and square waves with
adjustable frequencies
Analog Input measurements

1] To perform analog input measurements, insert a supported


analog input C Series I/O module into any slot on the cDAQ
chassis.

2] The type of C Series I/O module used to measure specifications


such as number of channels, channel configuration, sample rate,
and gain.

3] The NI cDAQ-9174 has three AI timing engines, which means


that three analog input tasks can be running at a time on a
chassis.
Analog Input triggering

Fig: Reference Trigger final


A trigger is a signal that causes an action, such as
starting or stopping the acquisition of data.

The NI cDAQ-9178/9174 chassis supports internal


software, external digital triggering, and analog triggering.

Three triggers are available: Start Trigger,


Reference Trigger
Pause Trigger.
An analog or digital trigger can initiate these three trigger actions.
Start Trigger signal to begin a measurement
acquisition

Reference Trigger to stop a measurement


acquisition.

Pause Trigger to pause and resume a


measurement acquisition.
Sample Clock is an active high pulse by default.

A sample consists of one reading from each channel in


the AI task.

Sample Clock signals start of a sample of all analog


input channels in the task.
Detailed Specifications
Analog Input

Input FIFO size 127 samples per slot

Maximum sample rate Determined by the C Series I/O


module(s)

Timing accuracy 50 ppm of sample rate

Timing resolution 12.5 ns

Number of channels supported Determined by the C Series I/O


module
Analog Output

Onboard regeneration 16

Non-regeneration Determined by the C Series I/O module

Non-hardware-timed task Determined by the C Series I/O module

Maximum update rate

Onboard regeneration
1.6 MS/s (multi-channel, aggregate)

Non-regeneration Determined by the C Series I/O module

Timing accuracy 50 ppm of sample rate

Timing resolution 12.5 ns


Data Acquisition
National Instruments 9237:
• 24-bit resolution, ±25 mV/V analog
inputs with RJ50 connectors

• 4 simultaneously sampled analog inputs;


50 kS/s maximum sampling rate

• Programmable half- and full-bridge


completion; up to 10 V internal
excitation

• 1 – 18V excitation
• Smart-sensor (TEDS) compatible

• Provides required signal conditioning for


un-amplified load cells
Data Acquisition

National Instruments 9201:

• 8 analog inputs, ±10 V input range

• 500 kS/s aggregate sampling rate

• 12-bit resolution, single-ended inputs,


screw terminal or D-Sub connectors.

• Hot-swappable operation; overvoltage


protection; isolation

• NIST-traceable calibration
Data Acquisition

National Instruments cDAQ-9174:

• Choose from more than 50 hot-


swappable I/O modules with integrated
signal conditioning
• Four general-purpose 32-bit
counter/timers built into chassis
(access through digital module)
• Run up to seven hardware-timed
analog I/O, digital I/O, or counter/timer
operations simultaneously
• Stream continuous waveform
measurements with patented NI Signal
Streaming technology
THANK YOU

You might also like