Labview Basics Course Slides

Download Report

Transcript Labview Basics Course Slides

1

Lesson 9 Data Acquisition and Waveforms TOPICS

Plug-in DAQ devices Data Acquisition in LabVIEW Analog Input Data Logging Analog Output Counters Digital I/O

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

3

Measurement Software Framework

NI-DAQ contains: •Traditional NI-DAQ •NI-DAQmx

DAQ Hardware Configuration

4

Measurement & Automation Explorer (MAX)

5

Channels and Tasks Channel names Sine Wave 1 Signals ai 0 ai 1 ai 2 Sine Wave 2 Sine Wave 3 Tasks Timing and Triggering

The DAQ Signal Accessory

NI-DAQmx versus Traditional NI-DAQ Productivity Performance Accuracy Quality Compatibility Feature

Test Panels DAQ Assistant with code generation On-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 650 Alliance members Integration with LabVIEW Developer Exchange discussion forum Compatible with Legacy ISA Boards

NI-DAQmx

            no

Traditional NI-DAQ

 no             Best  Good  Fair

7

8

Data Acquisition in LabVIEW Traditional NI-DAQ

Specific VIs for performing: • Analog Input • Analog Output • Digital I/O • Counter operations

NI-DAQmx

Next generation driver: • VIs for performing a task • One set of VIs for all measurement types

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

10

NI-DAQmx Data Acquisition Task Types

Measurement type can be: •Analog Input •Analog Output •Counter Input •Counter Output •Digital I/O

11

Analog Input

Analog Input task is specific to the measurement

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

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

14

Analog Output

Analog Output task is specific to the generation type

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

16

Counters

A counter is a digital timing device Typical 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 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

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

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.

19

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

20

Instrument Control Overview

Control any instrument if you know the following: – Type of connector on the instrument – Electrical properties involved – Software drivers available − Type of cables needed − Communication protocols used

Instruments Computer

GPIB Communication GPIB Interface GPIB Instruments GPIB Cable

22

Standards Introduction 1965 1975 1987 1990 1992 1993 HP designs HP-IB (Hewlett Packard Interface Bus) HP-IB becomes IEEE 488 IEEE 488.2 adopted IEEE 488 becomes IEEE 488.1

SCPI (Standard Commands for Programmable Instruments) added to IEEE 488.2

IEEE 488.2 revised HS488 proposed 1999 HS488 approved

23

GPIB Hardware Specifications

DIO1 DIO2 DIO3 DIO4 EOI DAV NRFD NDAC IFC SRQ ATN SHIELD 1 13 12 24 DIO5 DIO6 DIO7 DIO8 REN GND (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 • Max cable length between devices = 4 m (2 m average) • Max cable length = 20 m • Max number of devices = 15 (2/3 powered on)

GPIB Software Architecture — Windows Diagnostics Tools: GPIB Diagnostic Tool NI-Spy Interface Board (GPIB, PXI, VXI, computer based, etc.) Driver Software (*.DLL) NI-VISA Instrument Driver VIs LabVIEW Configuration Tools: Measurement & Automation Explorer

Configuring GPIB Board and Instruments

25

Measurement & Automation Explorer (MAX)

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

27

Communicating with an Instrument

28

Virtual Instrument Software Architecture

VISA

Serial GPIB VXI PXI

• 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

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:

30

Instrument Descriptor Syntax

• Resource Name contains interface info • VISA Aliases also work

Interface Serial GPIB VXI GPIB-VXI Resource Name Grammar ASRL[board][::INSTR] GPIB[board]::primary address[::INSTR] VXI[board]::VXI logical address[::INSTR] GPIB-VXI[board][::GPIB-VXI primary address]::VXI logical address[::INSTR]

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

32

Instrument Drivers

• More than 1200 LabVIEW Instrument drivers • Programming simplified to high-level API

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

34

IDNET - Instrument Driver Network

• Learn about drivers • Get help with developing drivers • Submit your driver to the network • Download drivers

35

Instrument Driver Model

36

Instrument Driver VIs

• Initialize • • • • Configure • • • • • • • • • Action/Status • • • • • • • • • • • • • Data • • • • • • • • • • • • • • • • • • • • • • • • • • • Utility • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Close • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •

•

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

38

Putting It All Together

• Initialize instrument • Do operation(s) • Close instrument • Check error status

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

PC Serial Port RS-232 Cable RS-232 Instrument

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 1 DCD 2 RxD 3 TxD 4 DTR 5 Com 6 DSR 7 RTS 8 CTS 9 RI DTE DCE Input Output I O O O I I I O I I I O O O

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

42

Using the Instrument I/O Assistant with Serial

• Select COMX as the instrument address • Use the I/O Assistant as done with GPIB

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

Lesson 11 VI Customization

44

TOPICS

Configuring Appearance of Front Panel SubVI Front Panels Keyboard Shortcuts VI Properties Customizing Palettes

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

46

Window Appearance

Only affects VI panel while VI is running

47

Window Size

• Set minimum and current panel size • Adjust size of panel relative to the monitor • Scale objects on panel as window resizes

48

Creating Pop-Up Panels – Every Instance

• Use Top-Level Application Window or Dialog appearance types • Create custom window appearance

49

Creating Pop-Up Panels – Single Instance

Access SubVI Node Setup by right-clicking on subVI icon on calling VI’s diagram

50

Key Navigation

Assigns keyboard strokes to front panel controls

51

Preventing Editing of a VI

• Opens, runs, and closes LabVIEW without user intervention • Remove menus, Abort button, etc… • Save with Options

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

53

Technical Support Resources

Award-Winning Website www.ni.com/support • Drivers & Updates • Product Manuals • KnowledgeBases • Example Code • Tutorials • Application Notes • Discussion Forums

Info-LabVIEW Listserve

User-sponsored Internet mailing list • Send subscription messages to the Info-LabVIEW list processor

[email protected]

• Send other administrative messages to the Info-LabVIEW list maintainer at

[email protected]

• Post a message to subscribers at

[email protected]

54

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