Labview Basics Course Slides
Transcript of Labview Basics Course Slides
![Page 1: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/1.jpg)
1
Lesson 9Data Acquisition and Waveforms
TOPICSPlug-in DAQ devicesData Acquisition in LabVIEWAnalog InputData LoggingAnalog OutputCountersDigital I/O
![Page 2: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/2.jpg)
2
Overview and Configuration
Fundamental task of a DAQ system is to measure or generate real-world physical signals
DAQ system consists of:•Transducers•Signal Conditioning•Plug-in DAQ device•Driver•Software
![Page 3: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/3.jpg)
3
Measurement Software Framework
NI-DAQ contains:•Traditional NI-DAQ•NI-DAQmx
![Page 4: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/4.jpg)
4
DAQ Hardware Configuration
Measurement & Automation Explorer (MAX)
![Page 5: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/5.jpg)
5
Channels and Tasks
Signalsai 0ai 1ai 2
Sine Wave 1
Sine Wave 2
Sine Wave 3
Channel names
TasksTiming and Triggering
![Page 6: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/6.jpg)
The DAQ Signal Accessory
![Page 7: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/7.jpg)
7
NI-DAQmx versus Traditional NI-DAQFeature NI-DAQmx Traditional NI-DAQTest Panels DAQ Assistant with code generation noOn-line diagnostics Scaling to voltage and physical units 50 kS/s with single point I/O Measurement multithreading Instant calibration Automatic selection of optimal gains Guaranteed lossless data
Integration with LabVIEWDeveloper Exchange discussion forumCompatible with Legacy ISA Boards no
650 Alliance members
Productivity
Performance
Accuracy
QualityBest
GoodFairCompatibility
![Page 8: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/8.jpg)
8
Data Acquisition in LabVIEW
Traditional NI-DAQSpecific VIs for performing:• Analog Input• Analog Output• Digital I/O• Counter operations
NI-DAQmxNext generation driver: • VIs for performing a
task• One set of VIs for all
measurement types
![Page 9: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/9.jpg)
9
NI-DAQmx Data Acquisition
Single set of VIs used to perform analog I/O, digital I/O, and counter operations
DAQ Assistant Express VI• Quickly and easily program the DAQ device• Creates a local task• Most applications can use the DAQ
Assistant Express VI
![Page 10: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/10.jpg)
10
NI-DAQmx Data Acquisition Task Types
Measurement type can be:•Analog Input•Analog Output•Counter Input•Counter Output•Digital I/O
![Page 11: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/11.jpg)
11
Analog Input
Analog Input task is specific to the measurement
![Page 12: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/12.jpg)
12
Analog Input Task Timing and Triggering
Configures the number of samples and sample rate for the task
Configures the start and reference triggers for the task
![Page 13: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/13.jpg)
13
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
![Page 14: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/14.jpg)
14
Analog Output
Analog Output task is specific to the generation type
![Page 15: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/15.jpg)
15
Analog Output Task Timing and Triggering
Configures the number of samples and sample rate for the task
Configures the start and reference triggers for the task
![Page 16: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/16.jpg)
16
CountersA counter is a digital timing deviceTypical uses of a counter:• Event counting• Frequency measurement• Period measurement• Position measurement• Pulse generation
Gate
Source
Output
Count Register
Count register – Stores the current count of the counterSource – Input that causes the counter to increment each time it togglesGate – Input that is used to enable or disable the function of the counterOutput – Signal that generates pulses or a series of pulses
![Page 17: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/17.jpg)
17
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
![Page 18: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/18.jpg)
18
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.
![Page 19: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/19.jpg)
19
Lesson 10Instrument Control
TOPICSInstrument Control Overview GPIB Communication and ConfigurationInstrument I/O AssistantVirtual Instrument Software Architecture (VISA)Instrument DriversSerial Port CommunicationWaveform Transfers
![Page 20: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/20.jpg)
20
Instrument Control OverviewControl 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
![Page 21: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/21.jpg)
GPIB Communication
GPIB Cable
GPIB Interface
GPIB Instruments
![Page 22: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/22.jpg)
22
Standards IntroductionHP designs HP-IB (Hewlett Packard Interface Bus)1965HP-IB becomes IEEE 4881975
1987 IEEE 488.2 adoptedIEEE 488 becomes IEEE 488.1
1990 SCPI (Standard Commands for Programmable Instruments) added to IEEE 488.2
1992 IEEE 488.2 revised
HS488 proposed1993
HS488 approved1999
![Page 23: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/23.jpg)
23
GPIB Hardware Specifications• Max cable length between
devices = 4 m (2 m average)• Max cable length = 20 m• Max number of devices =
15 (2/3 powered on)1
12
13
24
DIO5DIO6DIO7DIO8RENGND (TW PAIR W/DAV)GND (TW PAIR W/NRFD)GND (TW PAIR W/NDAC)GND (TW PAIR W/IFC)GND (TW PAIR W/SRQ)GND (TW PAIR W/ATN)SIGNAL GROUND
DIO1DIO2DIO3DIO4EOIDAV
NRFDNDAC
IFCSRQATN
SHIELD
![Page 24: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/24.jpg)
GPIB Software Architecture — Windows
Driver Software(*.DLL)
Instrument Driver VIsNI-VISA
LabVIEW
Diagnostics Tools:GPIB Diagnostic Tool
NI-Spy
Configuration Tools:Measurement &
Automation Explorer
Interface Board(GPIB, PXI,
VXI, computer based, etc.)
![Page 25: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/25.jpg)
25
Configuring GPIB Board and Instruments
Measurement & Automation Explorer (MAX)
![Page 26: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/26.jpg)
26
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
![Page 27: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/27.jpg)
27
Communicating with an Instrument
![Page 28: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/28.jpg)
28
Virtual Instrument Software Architecture
GPIB VXISerial PXI
VISA
• Platform independent• VISA is the backbone of the
IVI and Plug & Play Instrument Drivers
• Interface independent• Must know SCPI command
set to program directly with VISA
![Page 29: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/29.jpg)
29
VISA Terminology• Resource—Instrument, Serial Port, or Parallel Port• Session—Connection to a Resource• Instrument Descriptor—Resource location
– Format: Interface Type::Address::INSTR– Examples:
![Page 30: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/30.jpg)
30
Instrument Descriptor Syntax• Resource Name contains interface info• VISA Aliases also work
Interface Resource Name Grammar
Serial ASRL[board][::INSTR]
GPIB GPIB[board]::primary address[::INSTR]
VXI VXI[board]::VXI logical address[::INSTR]
GPIB-VXI GPIB-VXI[board][::GPIB-VXI primary address]::VXI logical address[::INSTR]
![Page 31: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/31.jpg)
31
VISA Resource Name
• Exact name and location of the instrument• Use the VISA Resource Name control• You can specify the full resource name of the VISA Alias
![Page 32: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/32.jpg)
32
Instrument Drivers• More than 1200 LabVIEW Instrument drivers
• Programming simplified to high-level API
![Page 33: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/33.jpg)
33
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
![Page 34: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/34.jpg)
34
IDNET - Instrument Driver Network
• Learn about drivers• Get help with developing drivers• Submit your driver to the network• Download drivers
![Page 35: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/35.jpg)
35
Instrument Driver Model
![Page 36: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/36.jpg)
36
• Initialize • • •
• Configure • • • • • • • •
• Action/Status • • • • • • • • • • • •
• Data • • • • • • • • • • • • • • • • • • • • • • • • • •
• Utility • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
• Close • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
•
Instrument Driver VIs
![Page 37: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/37.jpg)
37
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
![Page 38: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/38.jpg)
38
Putting It All Together
• Initialize instrument• Do operation(s)• Close instrument• Check error status
![Page 39: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/39.jpg)
39
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
RS-232 Instrument
RS-232 Cable
PC SerialPort
![Page 40: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/40.jpg)
40
Serial Hardware Connection• RS-232
– DCE or DTE configurations
– 9-pin or 25-pin• RS-422
– DCE or DTE– 8-pin
• RS-485– Multidrop
Pin DTE DCE
1 DCD Input Output2 RxD I O3 TxD O I4 DTR O I5 Com - -6 DSR I O7 RTS O I8 CTS I O9 RI I O
![Page 41: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/41.jpg)
41
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
![Page 42: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/42.jpg)
42
Using the Instrument I/O Assistant with Serial
• Select COMX as the instrument address
• Use the I/O Assistant as done with GPIB
![Page 43: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/43.jpg)
43
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
![Page 44: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/44.jpg)
44
Lesson 11VI Customization
TOPICSConfiguring Appearance of Front Panel SubVI Front PanelsKeyboard ShortcutsVI PropertiesCustomizing Palettes
![Page 45: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/45.jpg)
45
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
![Page 46: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/46.jpg)
46
Window AppearanceOnly affects VI panel while VI is running
![Page 47: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/47.jpg)
47
Window Size• Set minimum and current panel size• Adjust size of panel relative to the monitor• Scale objects on
panel as window resizes
![Page 48: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/48.jpg)
48
Creating Pop-Up Panels – Every Instance• Use Top-Level Application Window or Dialog appearance types• Create custom window appearance
![Page 49: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/49.jpg)
49
Creating Pop-Up Panels – Single InstanceAccess SubVI Node Setup by right-clicking on subVI icon on calling VI’s diagram
![Page 50: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/50.jpg)
50
Key NavigationAssigns keyboard strokes to front panel controls
![Page 51: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/51.jpg)
51
Preventing Editing of a VI• Opens, runs, and closes LabVIEW without
user intervention • Remove menus, Abort button, etc…• Save with Options
![Page 52: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/52.jpg)
52
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
![Page 53: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/53.jpg)
53
Technical Support Resources
Award-Winning Website www.ni.com/support• Drivers & Updates• Product Manuals• KnowledgeBases• Example Code• Tutorials• Application Notes• Discussion Forums
![Page 54: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/54.jpg)
54
Info-LabVIEW ListserveUser-sponsored Internet mailing list• Send subscription messages to the Info-LabVIEW list processor
• Send other administrative messages to the Info-LabVIEW list maintainer [email protected]
• Post a message to subscribers [email protected]
![Page 55: Labview Basics Course Slides](https://reader031.fdocuments.net/reader031/viewer/2022021009/6203aa9ada24ad121e4c0e26/html5/thumbnails/55.jpg)
55
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