LabView 3
LabView 3
TOPICS
Plug-in DAQ devices
Data Acquisition in LabVIEW
Analog Input
Data Logging
Analog Output
Counters
Digital I/O
1
Overview and Configuration
Fundamental task of a DAQ system is to
measure or generate real-world physical
signals
2
Measurement
Software
Framework
NI-DAQ contains:
•Traditional NI-DAQ
•NI-DAQmx
3
DAQ Hardware Configuration
4
Channels and Tasks
Channel names
Sine Wave 1
ai 0
Signals Sine Wave 2
ai 1
ai 2 Sine Wave 3
Tasks
Timing and Triggering
5
The DAQ Signal Accessory
NI-DAQmx versus Traditional NI-DAQ
Feature NI-DAQmx Traditional NI-DAQ
Test Panels
DAQ Assistant with code generation no
Productivity
On-line diagnostics
Scaling to voltage and physical units
50 kS/s with single point I/O
Performance
Measurement multithreading
Instant calibration
Accuracy Automatic selection of optimal gains
Guaranteed lossless data
650 Alliance members
Quality Integration with LabVIEW
Developer Exchange discussion forum Best
Good
Compatibility Compatible with Legacy ISA Boards no Fair
7
Data Acquisition in LabVIEW
8
NI-DAQmx Data Acquisition
9
NI-DAQmx Data Acquisition Task Types
Measurement type
can be:
•Analog Input
•Analog Output
•Counter Input
•Counter Output
•Digital I/O
10
Analog Input
11
Analog Input Task Timing and Triggering
12
Data Logging
• It is often necessary to permanently store data that is acquired
from the DAQ device
• LabVIEW includes the ability to read and write a LabVIEW
Measurement File
• LabVIEW Measurement File is an ASCII text file
13
Analog Output
14
Analog Output Task Timing and Triggering
15
Counters
A counter is a digital timing device
Typical uses of a counter:
• Event counting Gate Output
• Frequency measurement
Count Register
• Period measurement
• Position measurement Source
• Pulse generation
Count register – Stores the current count of the counter
Source – Input that causes the counter to increment each time it toggles
Gate – Input that is used to enable or disable the function of the counter
Output – Signal that generates pulses or a series of pulses
16
Digital Input and Output
• Digital I/O can
read from or write
to a line or an
entire digital port
• A digital port is a
collection of digital
lines
17
Summary
• MAX is the primary configuration and testing utility that is
available for the DAQ device.
• The DAQ Assistant is used to configure the DAQ device and
perform data acquisition.
• Most application can use the DAQ Assistant. For applications
that require advanced timing and synchronization use the VIs
that come with NI-DAQmx.
• The DAQ Assistant can perform Analog Input, Analog Output,
Digital I/O, and Counter operations.
18
Lesson 10
Instrument Control
TOPICS
Instrument Control Overview
GPIB Communication and Configuration
Instrument I/O Assistant
Virtual Instrument Software Architecture (VISA)
Instrument Drivers
Serial Port Communication
Waveform Transfers
19
Instrument Control Overview
Control any instrument if you know the following:
– Type of connector on the instrument − Type of cables needed
– Electrical properties involved − Communication protocols used
– Software drivers available
Instruments Computer
20
GPIB Communication
GPIB Interface
GPIB Instruments
GPIB
Cable
Standards Introduction
1965 HP designs HP-IB (Hewlett Packard Interface Bus)
1975 HP-IB becomes IEEE 488
22
GPIB Hardware Specifications
• Max cable length between
devices = 4 m (2 m average)
• Max cable length = 20 m
DIO1 DIO5 • Max number of devices =
DIO2
DIO3
1 13 DIO6
DIO7 15 (2/3 powered on)
DIO4 DIO8
EOI REN
DAV GND (TW PAIR W/DAV)
NRFD GND (TW PAIR W/NRFD)
NDAC GND (TW PAIR W/NDAC)
IFC GND (TW PAIR W/IFC)
SRQ GND (TW PAIR W/SRQ)
ATN 12 24 GND (TW PAIR W/ATN)
SHIELD SIGNAL GROUND
23
GPIB Software Architecture — Windows
Diagnostics Tools:
GPIB Diagnostic Tool
NI-Spy
Driver
Instrument
Software NI-VISA
Interface Board Driver VIs
(*.DLL)
(GPIB, PXI, LabVIEW
VXI, computer
based, etc.)
Configuration Tools:
Measurement &
Automation Explorer
Configuring GPIB Board and Instruments
25
What is the Instrument I/O Assistant?
• Accessed through a LabVIEW
Express VI
• Sets up device
communication and data
parsing step by step through
a configuration interface
26
Communicating with an Instrument
27
Virtual Instrument Software Architecture
VISA
28
VISA Terminology
• Resource—Instrument, Serial Port, or Parallel Port
• Session—Connection to a Resource
• Instrument Descriptor—Resource location
– Format: Interface Type::Address::INSTR
– Examples:
29
Instrument Descriptor Syntax
• Resource Name contains interface info
• VISA Aliases also work
Serial ASRL[board][::INSTR]
30
VISA Resource Name
31
Instrument Drivers
• More than 1200 LabVIEW Instrument drivers
• Programming simplified to high-level API
32
Installing and Finding Instrument Drivers
• Drivers available at ni.com/idnet
• Install the instrument driver VI Library into LabVIEW
7.0\instr.lib directory
• Access drivers from Functions»Input»Instrument Drivers
subpalette
33
IDNET - Instrument Driver Network
• Learn about drivers
• Get help with developing drivers
• Submit your driver to the network
• Download drivers
34
Instrument Driver Model
35
Instrument Driver VIs
• Initialize • • •
• Configure • • • • • • • •
• Action/Status • • • • • • • • • • • •
• Data • • • • • • • • • • • • • • • • • • • • • • • • • •
• Utility • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
• Close • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
•
36
Instrument Driver Inputs and Outputs
HP34401A Initialize.vi
• Instrument Descriptor
• VISA Sessions
- A connection or link to a specific instrument
- Created after instrument is initialized
- Used throughout VI whenever you communicate with that specific
instrument
• Error cluster
37
Putting It All Together
• Initialize instrument
• Do operation(s)
• Close instrument
• Check error status
38
Serial Communication
• Popular means of communication between computer and
peripheral device
• Data sent one bit at a time across the cable
• Used for low transfer rates or long distances
• Only a cable is needed since most computers have at least
one available serial port
PC Serial
Port
RS-232 Cable
RS-232 Instrument
39
Serial Hardware Connection
• RS-232
– DCE or DTE
configurations
– 9-pin or 25-pin Pin DTE DCE
• RS-422 1 DCD Input Output
2 RxD I O
– DCE or DTE 3 TxD O I
– 8-pin 4 DTR O I
5 Com - -
• RS-485 6 DSR I O
7 RTS O I
– Multidrop 8 CTS I O
9 RI I O
40
Serial Communication
Terminology
• Baud rate – bits per second
• Data bits – inverted logic and LSB first
• Parity – optional error-checking bit
• Stop bits – 1, 1.5, or 2 inverted bits at data end
• Flow control – hardware and software handshaking options
41
Using the Instrument I/O Assistant with Serial
• Select COMX as
the instrument
address
• Use the I/O
Assistant as done
with GPIB
42
Summary
• LabVIEW can communicate with any instrument that connects to
your computer if you know the interface type
• Use the Measurement & Automation Explorer (MAX) to detect,
configure, and test your GPIB interface and instruments
• Use the Instrument I/O Assistant for easy and fast GPIB and serial
programming.
• An instrument driver eliminates the need for your to have detailed
knowledge of the specific strings used by an instrument
• Instrument Library – more than 2000 instruments supported
• Instrument driver VIs share a common hierarchy and come with an
example to help you get started
43
Lesson 11
VI Customization
TOPICS
Configuring Appearance of Front Panel
SubVI Front Panels
Keyboard Shortcuts
VI Properties
Customizing Palettes
44
Customizing VI Properties
• Access VI Properties by right-clicking the icon pane or selecting it
from the File menu
• Affects every instance of that VI in all applications
45
Window Appearance
Only affects VI panel while VI is running
46
Window Size
• Set minimum and current panel size
• Adjust size of panel relative to the monitor
• Scale objects on
panel as window
resizes
47
Creating Pop-Up Panels – Every Instance
• Use Top-Level Application Window or Dialog appearance types
• Create custom window appearance
48
Creating Pop-Up Panels – Single Instance
Access SubVI Node Setup by right-clicking on subVI icon on
calling VI’s diagram
49
Key Navigation
Assigns keyboard strokes to
front panel controls
50
Preventing Editing of a VI
• Opens, runs, and closes LabVIEW without
user intervention
• Remove menus, Abort button, etc…
• Save with Options
51
Summary
• Use VI Properties to set VI execution, window, and documentation
options
• Use SubVI Node Setup to set execution options for a single
instance of a subVI
• Use the Key Navigation option to assign front panel controls to a
keyboard key combination
• Use the Save with Options from the file menu to make backups of
your VIs
• You can often edit VIs by aborting them from the diagram of
another VI
52
Technical Support Resources
Award-Winning Website www.ni.com/support
• Drivers & Updates
• Product Manuals
• KnowledgeBases
• Example Code
• Tutorials
• Application Notes
• Discussion Forums
53
Info-LabVIEW Listserve
User-sponsored Internet mailing list
• Send subscription messages to the Info-LabVIEW list processor
listmanager@pica.army.mil
• Send other administrative messages to the Info-LabVIEW list
maintainer at
info-labview-REQUEST@pica.army.mil
• Post a message to subscribers at
info-labview@pica.army.mil
54
LabVIEW Publications
• LabVIEW Technical Resource quarterly newsletter by LTR
Publishing
• LabVIEW Graphical Programming and LabVIEW Power
Programming by Gary W. Johnson, McGraw-Hill
• LabVIEW for Everyone by Lisa K. Wells and Jeffrey Travis,
Prentice-Hall
• LabVIEW Signal Processing by Mahesh Chugani, Abhay Samant,
and Michael Cerna, Prentice-Hall
• LabVIEW Applications and Solutions by Rahman Jamal and Herbert
Pichlik, Prentice-Hall
55