Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 9 Data Acquisition and Waveforms

Similar presentations

Presentation on theme: "Lesson 9 Data Acquisition and Waveforms"— Presentation transcript:

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 This lesson introduces data acquisition. This lesson covers: A brief discussion of boards and DAQ concepts. The organization of LabVIEW DAQ VIs. How to acquire an analog reading. How to output an analog signal. How to use counters. How to acquire data continuously. The most important thing to remember about both Lesson 9 and 10 is that this course is not meant to be anything more than a BRIEF introduction to let them know this capability exists. If they are pressing for more information, point them to the other Customer Education courses.

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 Before a computer-based measurement system can measure a physical signal, such as temperature, a sensor or transducer must convert the physical signal into an electrical one, such as voltage or current. You might consider the plug-in DAQ device to be the entire measurement system, but it is actually only one system component. You cannot always directly connect signals to a plug-in DAQ device. In these cases, you must use signal conditioning accessories to condition the signals before the plug-in DAQ device converts them to digital information. The software controls the DAQ system by acquiring the raw data, analyzing, and presenting the results.

3 Measurement Software Framework
NI-DAQ contains: Traditional NI-DAQ NI-DAQmx NI-DAQ 7.0 contains two NI-DAQ drivers—Traditional NI-DAQ and NI-DAQmx—each with its own application programming interface (API), hardware configuration, and software configuration. Traditional NI-DAQ is an upgrade to NI-DAQ 6.9.x, the earlier version of NI-DAQ. Traditional NI-DAQ has the same VIs and functions and works the same way as NI-DAQ 6.9.x. You can use Traditional NI-DAQ on the same computer as NI-DAQmx, which you cannot do with NI-DAQ 6.9.x. NI-DAQmx is the latest NI-DAQ driver with new VIs, functions, and development tools for controlling measurement devices. The advantages of NI-DAQmx over previous versions of NI-DAQ include the DAQ Assistant for configuring channels and measurement tasks for a device; increased performance, including faster single-point analog I/O and multithreading; and a simpler API for creating DAQ applications using fewer functions and VIs than earlier versions of NI-DAQ. Traditional NI-DAQ and NI-DAQmx support different sets of devices. This lesson concerns the NI-DAQmx driver.

4 DAQ Hardware Configuration
The Windows Configuration Manager keeps track of all the hardware installed in your computer, including National Instruments DAQ devices. If you have a Plug & Play (PnP) device, such as an E-Series MIO device, the Windows Configuration Manager automatically detects and configures the device. If you have a non-PnP device, or legacy device, you must configure the device manually using the Add New Hardware option in the Control Panel. You can verify the Windows Configuration by accessing the Device Manager, available by selecting Start»Settings»Control Panel»System»Device Manager. You can see Data Acquisition Devices, which lists all DAQ devices installed in your computer. Double-click a DAQ device to display a dialog box with tabbed pages. The General tab displays overall information regarding the device. The Resources tab specifies the system resources to the device such as interrupt levels, DMA, and base address for software-configurable devices. The NI-DAQ Information tab specifies the bus type of the DAQ device. The Driver tab specifies the driver version and location for the DAQ device. LabVIEW installs Measurement & Automation Explorer (MAX), which establishes all device and channel configuration parameters. After installing a DAQ device in your computer, you must run this configuration utility. MAX reads the information the Device Manager records in the Windows Registry and assigns a logical device number to each DAQ device. Use the device number to refer to the device in LabVIEW. Access MAX either by double-clicking its icon on the desktop or selecting Tools»Measurement & Automation Explorer in LabVIEW. Measurement & Automation Explorer (MAX)

5 Channels and Tasks Channel names ai 0 Signals ai 1 ai 2 Tasks
Sine Wave 1 ai 0 Signals ai 1 Sine Wave 2 ai 2 Sine Wave 3 Tasks In Traditional NI-DAQ you can configure a set of virtual channels, or a collection of property settings that include a physical channel, the type of measurement or generation specified in the channel name, and scaling information. In Traditional NI-DAQ and earlier versions, virtual channels are a simple method to remember which channels are used for different measurements. NI-DAQmx Channels are similar to the virtual channels of Traditional NI-DAQ. NI-DAQmx also includes tasks which are integral to the API. A task is a collection of one or more channels and the timing, triggering, and other properties that apply to the task itself. A task represents a measurement or generation you want to perform. Channels created only inside a task are local. Channels defined outside a task are global and can be used separately. Configuring virtual channels is optional in Traditional NI-DAQ and earlier versions, but is integral to every measurement you take in NI-DAQmx. In Traditional NI-DAQ, you configure virtual channels in MAX. In NI-DAQmx, you can configure virtual channels either in MAX or in a program, and you can configure channels as part of a task or separately. In the example, analog input signals are routed into the DAQ system. The ai signals have been given channel names of Sine Wave 1, Sine Wave 2, and Sine Wave 3. The DAQ System is programmed to perform a task. A task is a collection of one or more channels, timing, and triggering. A task represents a measurement or generation you want to perform. Timing and Triggering

6 The DAQ Signal Accessory
not in course manual: Before the class starts Exercise, you should explain the following points about using the DAQ Signal Accessory (DSA): The 5V line from the DAQ device supplies power to the DSA. Analog input channels 1 and 2 are available at the quick connect terminal located in the lower central portion of the top panel. The IC temperature sensor is hard-wired to AI channel 0 and is located in the lower right hand corner of the top panel. Analog output channels 0 and 1 are available at the quick connect terminal located at the lower central portion of the top panel. The function generator is located in the lower central portion of the top panel. It produces a sine wave and a square wave. Use the Frequency Range selector switch to select a frequency range and then use the Frequency Adjust knob next to it to further adjust the frequency. There is a row of four LEDs in the middle of the DAQ Signal Accessory that correspond to Lines 0 to 3 on Port 0 of the MIO board. The four LEDs use inverted logic. Briefly describe the other parts of the DSA. Instructor — make sure each student has at least one wire with stripped ends.

7 NI-DAQmx versus Traditional NI-DAQ
Feature NI-DAQmx Traditional NI-DAQ Test Panels DAQ Assistant with code generation no 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 Productivity Performance Accuracy Point out all the benefits of using NI-DAQmx. However, if you are using a legacy board or a legacy application, continue to use Traditional NI-DAQ. Quality Compatibility  Best Good ž Fair

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 The Data Acquisition palette in LabVIEW contains a palette for traditional NI-DAQ and one for NI-DAQmx. Traditional VIs are divided by the type of measurement; DAQmx VIs are divided by the type of task.

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 The DAQmx-Data Acquisition palette contains all of the VIs necessary to perform analog I/O, digital I/O, and counter/timer operations. The VIs are organized so that the most common operations can be performed using the VIs. You can configure a task to perform a very specific function by using the Property Nodes in the palette. Many applications that do not require advanced timing and synchronization can be performed by using the DAQ Assistant Express VI. This course describes the use of the DAQ Assistant Express VI to perform data acquisition.

10 NI-DAQmx Data Acquisition Task Types
Measurement type can be: Analog Input Analog Output Counter Input Counter Output Digital I/O The DAQ Assistant Express VI allows you to easily configure the data acquisition device. When you place the DAQ Assistant Express VI on the block diagram, a dialog box appears where you configure a local task to perform a specific measurement function. Creating a local task allows you to specify the exact type of measurement to take. Once you create a task, the information for the local task is stored in the DAQ Assistant Express VI. You can reconfigure the DAQ Assistant Express VI by double-clicking the VI and creating a new task.

11 Analog Input Analog Input task is specific to the measurement
An analog input measurement type for a task can be voltage, temperature, strain, current, resistance, or frequency. Each measurement type has its own characteristics, such as resistor values for current measurements, or strain gauge parameters for strain measurements.

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 Task Timing When performing analog input, the task can be timed to Acquire 1 Sample, Acquire n Samples, or Acquire Continuously. Acquire 1 Sample: acquires one value from an input channel and immediately returns the value. This operation does not require any buffering or hardware timing. Acquire n Samples: One way to acquire multiple samples for one or more channels is to acquire single samples in a repetitive manner. However, acquiring a single data sample on one or more channels over and over is inefficient and time consuming. Moreover, you do not have accurate control over the time between each sample or channel. Instead you can use hardware timing, which uses a buffer in computer memory, to acquire data more efficiently. Acquire Continuously: view, process, or log a subset of the samples as they are acquired. Task Triggering When a device controlled by NI-DAQmx does something, it performs an action. Two very common actions are producing a sample and starting a waveform acquisition. Every NI-DAQmx action needs a stimulus or cause. When the stimulus occurs, the action is performed. Causes for actions are called triggers. Start Trigger: This trigger starts the acquisition. Reference Trigger: This trigger establishes the reference point in a set of input samples. Data acquired up to the reference point is pretrigger data. Data acquired after the reference point is posttrigger data.

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 It is often necessary to permanently store data that is acquired from the DAQ device. The following considerations are important when planning to store data to a file. Not all data logging applications use LabVIEW to process and analyze the stored data. Consider which applications will read the data that is stored. The format in which the data is stored defines which applications can read the file. Since LabVIEW contains standard file operation functions that exist in other languages, the programmer is in complete control over the data logging process. LabVIEW includes the ability to create a LabVIEW Measurement File, an ASCII text file that can be read by a spreadsheet, or a text editor. The LabVIEW Measurement File is easy to create in LabVIEW, and easy to read in LabVIEW or other applications. The Write LabVIEW Measurement File Express VI located on the Functions»Output palette writes signals to a LabVIEW Measurement File. When you place this Express VI on the block diagram, a configuration dialog box appears where you can specify how to store the file. The Read LabVIEW Measurement File Express VI located on the Functions»Input palette reads signals in a LabVIEW Measurement File. The data is read one point at a time, so it is necessary to place this Express VI in a loop.

14 Analog Output Analog Output task is specific to the generation type
Use analog output to perform digital-to-analog (D/A) conversions. An analog output task can be voltage or current. To perform a voltage or current task, a compatible device must be installed that can generate that form of signal.

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 Task Timing When performing analog output, the task can be timed to Generate 1 Sample, Generate n Samples, or Generate Continuously. Generate 1 Sample: Use single updates if the signal level is more important than the generation rate. You can use software timing to control when your device generates a signal. This operation does not require any buffering or hardware timing. Generate n Samples: You can use software timing or hardware timing to control when a signal is generated. With software timing, the rate at which the samples are generated is determined by the software and operating system instead of by the measurement device. With hardware timing, a TTL signal, such as a clock on your device, controls the rate of generation. A hardware clock can run much faster than a software loop. A hardware clock is also more accurate than a software loop. Use Generate n Samples if you want to generate a finite time-varying signal, such as an AC sine wave. Generate Continuously: Continuous generation is similar to generate n samples, except that an event must occur to stop the generation. Task Triggering Start Trigger: This trigger starts the generation. Reference Trigger: The reference trigger is not supported for analog output tasks.

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 Output Count Register Source 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 A counter is a digital timing device. You typically use counters for event counting, frequency measurement, period measurement, position measurement, and pulse generation. A counter contains four main components: a count register, a source, a gate, and an output. Count Register—Stores the current count of the counter. You can query the count register with software. Source—An input signal that can change the current count stored in the count register. The counter looks for rising or falling edges on the source signal. Whether a rising or falling edge changes the count is software selectable. The type of edge selected is referred to as the active edge of the signal. When an active edge is received on the source signal the count changes. Whether an active edge increments or decrements the current count is also software selectable. Gate—An input signal that determines if an active edge on the source will change the count. Counting can occur when the gate is high, low, or between various combinations of rising and falling edges. Gate settings are made in software. Output—An output signal that generates pulses or a series of pulses, otherwise known as a pulse train. When you configure a counter for simple event counting, the counter increments when an active edge is received on the source.

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 Measuring and generating digital values is used in a variety of applications including controlling relays and monitoring alarm states. Generally, measuring and generating digital values is used in laboratory testing, production testing, and industrial process monitoring and control. Digital I/O can read from or write to a line or an entire digital port, which is a collection of lines. You can use the digital lines in your DAQ device to acquire a digital value. This acquisition is based on software timing. On some devices, you can configure the lines individually to either measure or generate digital samples. Each line corresponds to a channel in your task. You can use the digital port(s) in your DAQ device to acquire a digital value from a collection of digital lines. This acquisition is based on software timing. You can configure the ports individually to either measure or generate digital samples. Each port corresponds to a channel in your task.

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. Do not immediately display this slide. Suggested questions for class participation: How are DAQ Boards configured? How can you test the configuration of your board? Point out that more in-depth DAQ information is available in the LabVIEW DAQ course.

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 This chapter introduces Serial and GPIB instrument control using LabVIEW. This lesson covers: GPIB (IEEE 488) background. Instrument drivers in LabVIEW. GPIB control using VISA Serial communication background. Serial control using VISA ASCII and binary waveform transfer.

20 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 You are not limited to the type of instrument that you control if you choose industry-standard control technologies. You can use instruments from many different categories, including serial, GPIB, VXI, PXI, computer-based instruments, Ethernet, SCSI, CAMAC, and parallel port devices. This lesson describes the two most common instrument communication methods, GPIB and serial port communication. Take note of the following with PC control of instrumentation: Type of connector (pinouts) on the instrument Cables needed—null-modem, number of pins, male/female Electrical properties involved—signal levels, grounding, cable length restrictions Communication protocols used—ASCII commands, binary commands, data format Software drivers available

21 GPIB Communication GPIB Interface GPIB Instruments GPIB Cable
GPIB Communications Briefly describe a typical system containing several GPIB devices connected to a computer. Describe that one device is the System Controller and the others are Talkers/Listeners. Each device on the GPIB has a unique address. GPIB instruments offer test and manufacturing engineers the widest selection of vendors and instruments for general-purpose to specialized vertical market test applications. GPIB instruments have traditionally been used as standalone benchtop instruments where measurements are taken by hand. Many GPIB instruments used today are still used in this fashion.

22 Standards Introduction
1965 HP designs HP-IB (Hewlett Packard Interface Bus) 1975 HP-IB becomes IEEE 488 1987 IEEE adopted IEEE 488 becomes IEEE 488.1 1990 SCPI (Standard Commands for Programmable Instruments) added to IEEE 488.2 1992 IEEE revised 1993 HS488 proposed Introduction of Standards to Instrument Communication In 1965, Hewlett-Packard designed the Hewlett-Packard Interface Bus (HP-IB) to connect their line of programmable instruments to their computers. Because of its high transfer rates (nominally 1 MB/s), this interface bus quickly gained popularity. It was later accepted as IEEE Standard Today, the name General Purpose Interface Bus (GPIB) is more widely used than HP-IB. Because the original IEEE 488 document contained no guidelines for a preferred syntax and format conventions, work continued on the specification to enhance system compatibility and configurability among test systems. This work resulted in a supplement standard IEEE 488.2, Codes, Formats, Protocols, and Common Commands, for use with IEEE 488 (renamed to ANSI/IEEE Standard ). IEEE does not replace IEEE Many devices still conform only to IEEE IEEE builds on IEEE by defining a minimum set of device interface capabilities, a common set of data codes and formats, a device message protocol, a generic set of common device commands, and a new status reporting model. In 1990, the IEEE specification included the Standard Commands for Programmable Instrumentation (SCPI) document. SCPI defines specific commands that each instrument class, which usually includes instruments from various vendors, must obey. Thus, SCPI guarantees complete system compatibility and configurability among these instruments. It is no longer necessary to learn a different command set for each instrument in an SCPI-compliant system, and it is easy to replace an instrument from one vendor with an instrument from another. 1999 HS488 approved

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 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 DIO1 DIO2 DIO3 DIO4 EOI DAV NRFD NDAC IFC SRQ ATN SHIELD Hardware Specifications The GPIB is a digital, 24-conductor parallel bus. It consists of eight data lines (DIO 1-8), five bus management lines (EOI, IFC, SRQ, ATN, REN), three handshake lines (DAV, NRFD, NDAC), and eight ground lines. The GPIB uses an eight-bit parallel, byte-serial, asynchronous data transfer scheme. This means that whole bytes are sequentially handshaked across the bus at a speed that the slowest participant in the transfer determines. Because the unit of data on the GPIB is a byte (eight bits), the messages transferred are frequently encoded as ASCII character strings. Additional electrical specifications allow data to be transferred across the GPIB at the maximum rate of 1 MB/sec because the GPIB is a transmission line system. These specifications are: A maximum separation of 4 m between any two devices and an average separation of 2 m over the entire bus. A maximum cable length of 20 m. A maximum of 15 devices connected to each bus with at least two-thirds of the devices powered on. If you exceed any of these limits, you can use additional hardware to extend the bus cable lengths or expand the number of devices allowed. Note For more information about GPIB, visit the National Instruments GPIB support website at

24 GPIB Software Architecture — Windows
Diagnostics Tools: GPIB Diagnostic Tool NI-Spy Driver Software (*.DLL) Instrument Driver VIs NI-VISA Interface Board (GPIB, PXI, VXI, computer based, etc.) LabVIEW Underneath and between the different hardware components are the software components that are the heart of your instrumentation system. The figure above shows the software architecture for Windows 2000/XP from the perspective of the computer. The instrument is connected to the computer through a built-in connector such as RS-232 or an installed interface board such as GPIB or VXI/MXI. Driver-level software for instrument is in the form of a Dynamic Link Library (DLL). In the example shown in the figure above, LabVIEW is the high-level application software layer. LabVIEW includes built-in functions for GPIB, serial, VXI, and computer-based instruments that load and use the installed driver software. As with all Windows device drivers, any DLLs you install for interface boards will also interact with the Windows Registry so that resources such as base addresses, interrupt levels, and DMA channels can be assigned. Configuration and diagnostic software tools are also available with National Instruments hardware. Refer in-depth questions to technical support or suggest that the students purchase the GPIB course. Instructor - Show how the Measurement & Automation Explorer allows you to obtain information about your GPIB interfaces as well as the DAQ board. Configuration Tools: Measurement & Automation Explorer

25 Configuring GPIB Board and Instruments
Explain that the Measurement and Automation Explorer (MAX) allows you to: Configure the GPIB card and search for instruments Set the VISA alias name Run NI-Spy Configure IVI instrument drivers (be careful you may confuse some people if you go into a long dialogue about IVI). If a GPIB+ card is installed you can run the GPIB analyzer software from MAX 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 The Instrument I/O Assistant located on the Functions»Input and Functions»All Functions»Instrument I/O palettes is a LabVIEW Express VI that allows you to easily test communication with your instrument and develop a sequence of query, parse, and write steps. These steps can be saved as an Express VI for instant use or can be converted to a LabVIEW subVI. Use the Instrument I/O Assistant when an instrument driver is not available.

27 Communicating with an Instrument
Once you have placed the I/O Assistant on the block diagram, the wizard opens. The wizard starts in the Select Instrument step, where you can choose a GPIB or serial instrument. You also can check the interface properties from this window. After selecting the instrument, you can add sequences to Query and Parse, Write, or Read and Parse. In addition, after you have set up a communication sequence with one instrument, you can set up additional instruments in the same Express VI. In the figure above, a GPIB instrument was set up, then a query (*IDN?) was sent to the instrument. The response was automatically parsed, resulting in a string output.

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 Using VISA Functions VISA is the underlying layer of function calls used in the LabVIEW instrument driver VIs to communicate with the driver software. This section describes what VISA is and how you use VISA functions in LabVIEW instrument drivers. VISA History and Definitions For many years, industry has moved toward purchasing instrumentation from a variety of vendors. This allows engineers to select the best possible equipment for their applications without being locked into a specific vendor. This trend required the definition of hardware standards to ensure the compatibility between different modules. This was one of the factors leading to the development of the VXI specification. But even with these improved hardware standards, a system was time consuming and expensive to put together. Successful integration of a multivendor system requires all hardware and software products work together, eliminating system-level compatibility issues for end-users. National Instruments initially addressed the software problems with instrument drivers, which helped reduce both integration time and software development costs. In 1993, National Instruments joined with GenRad, Racal Instruments, Tektronix, and Wavetek to form the VXIplug&play Systems Alliance. The goals of the alliance are to ensure multivendor interoperability for VXI systems and to reduce the development time for an operational system.

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: VISA Programming Terminology Before being introduced to VISA programming, you should become familiar with some of the VISA terminology. The most important objects in the VISA language are known as resources. The functions you can use with an object are known as operations. In addition to the operations that you can use an object, the object has variables, known as attributes, associated with it that contain information related to the object. Three terms need definitions: Resource: This is any instrument in your system (includes serial and parallel ports). Session: You must open a VISA session to a resource to communicate with it, similar to a communication channel. When you open a session to a resource, you are returned a VISA Session Number, which is a unique handle to that instrument. You must use the Session Number in all subsequent VISA functions. In LabVIEW, this is a refnum. Instrument Descriptor: This is the exact name of a resource. The descriptor specifies the interface type (GPIB, VXI, ASRL), the address of the device (logical address or primary address) and the VISA Session type (INSTR or Event).

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] VISA: Virtual Instrument Software Architecture. A protocol built upon driver and functions to meet the industry needs for having a way to easily interface with multiple I/Os and have all manufacturers of instruments and instrument drivers follow a protocol. VISA created by the VXIplug&play Alliance which is composed of the top 35 instrument manufacturers such as HP. National Instruments is a leading member of the alliance. The resource name contains information on the type of I/O interface and the device address.

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 Explain to the students that we need some means of identifying which device we want to talk to. This is done by specifying a VISA resource name. Two examples of VISA resource names are shown on the slide. The first one tells the VISA functions that the instrument can be found on: The GPIB bus At primary address 2 and that it is an instrument type device The second example is a VISA alias and is assigned to the instrument in MAX. The alias allows you to give an instrument a meaningful name

32 Instrument Drivers More than 1200 LabVIEW Instrument drivers
Programming simplified to high-level API LabVIEW provides more than 1200 LabVIEW instrument drivers from more than 50 vendors. You can use these instrument drivers to build complete systems quickly. Instrument drivers drastically reduce software development costs because developers do not need to spend time programming their instruments. You can reuse the drivers in a variety of systems and configurations. LabVIEW instrument drivers simplify instrument programming to high-level commands, so you do not need to learn the low-level instrument-specific syntax needed to control your instruments. The programming is broken down into general functions for the DMM These instrument drivers are called LabVIEW instrument drivers because the source code is graphical programming made from standard LabVIEW functions and VIs. LabVIEW instrument drivers are in the form of VI libraries and are organized into categories of instrument functions. You will learn about each category.

33 Installing and Finding Instrument Drivers
Drivers available at Install the instrument driver VI Library into LabVIEW 7.0\instr.lib directory Access drivers from Functions»Input»Instrument Drivers subpalette Installing and Accessing Instrument Drivers You can find the LabVIEW instrument drivers on your LabVIEW installation CD or download them from the National Instruments web page at The LabVIEW Instrument Wizard can automatically install instrument drivers. If you install the LabVIEW instrument drivers from the CD yourself or download them from the web page, you first decompress the instrument driver files to get a directory of instrument driver files. Place this directory into the LabVIEW\instr.lib directory on your computer. The next time you launch LabVIEW, you can access the instrument driver VIs from the Input »Instrument Drivers subpalette of the Functions palette as shown in the slide above.

34 IDNET - Instrument Driver Network
Learn about drivers Get help with developing drivers Submit your driver to the network Download drivers The Instrument Driver Network at is the industry’s largest source of instrument drivers, featuring drivers for over 2,200 instruments from 150 vendors. Here, you can learn about, download, develop, and submit drivers for controlling instruments from LabVIEW, LabWindows/CVI, and Measurement Studio.

35 Instrument Driver Model
All instrument drivers in the library have the same VI Tree structure. Therefore, once you learn to use one instrument driver, all others have the same basic hierarchy. In fact, this hierarchy, sequence of VIs, and error checking are used in many other areas of I/O in LabVIEW such as file I/O, data acquisition (DAQ), and TCP/IP communications. The structure of an instrument driver is shown in the figure above. The high-level functions are built from the lower-level functions. For the most control over the instrument, you would use the lower-level functions. However, the high-level functions like the Getting Started VI you used in the previous lesson are easy to use and have soft front panels that resemble the instrument. The component functions of instrument drivers are organized into the following categories: Initialize Configure Action/Status Data Utility Close

36 Instrument Driver VIs Initialize • • • Configure • • • • • • • •
Action/Status • • • • • • • • • • • • Data • • • • • • • • • • • • • • • • • • • • • • • • • • Utility • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Close • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Instrument Driver VIs Initialize—Initializes the communication channel to the instrument. The initialize VI can optionally perform an identification query and reset operation. In addition, it can perform any necessary actions to place the instrument in its default power-on state or other specified state. Configure—A collection of VIs that configure the instrument for the operations you want to perform. An example is a function to set up the trigger rate. Action/Status—Contains both action and status VIs. Action VIs cause the instrument to initiate or terminate test and measurement operations. Status VIs obtain the current status of the instrument or the status of pending operations. An example of an action function is Acquire Single Shot. An example of a status function is Query Transfer Pending. Data—VIs that transfer data to or from the instrument such as reading a measured waveform from the instrument or downloading a waveform to the instrument. Utility—VIs that perform a wide variety of useful functions such as reset, self-test, error query, and revision query. Close—Terminates the communication channel to the instrument and de-allocates the resources set aside for that instrument.

37 Instrument Driver Inputs and Outputs
HP34401A 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 Inputs and Outputs Common to Instrument Driver VIs Now that you have learned some common techniques for building and editing LabVIEW VIs, you will start using instrument driver VIs to build applications. Just as all instrument drivers share a common set of functions, they also share common inputs and outputs. Instrument Descriptor—The instrument descriptor is the address or VISA alias of the instrument. VISA Sessions—Before you can communicate with an instrument, you need to open a communication link to the instrument with an Initialize VI. When the connection to the instrument is made, a VISA session number is returned. That VISA session is a connection or link to a resource, your instrument. Each time you communicate with that device again, you need to wire the VISA session input on the instrument driver VIs. After you are finished communicating with the instrument, you call the Close instrument driver VI, and all references or resources for the instrument are closed. Note VISA session and instrument descriptor are terms used with the majority of LabVIEW instrument drivers that were written with VISA 2.0. LabVIEW instrument drivers written with VISA 2.5 and later use the term VISA resource name. The functionality and usage are practically identical.

38 Putting It All Together
Initialize instrument Do operation(s) Close instrument Check error status Putting It All Together Now that you have learned all the instrument driver-specific inputs and outputs, you are ready to use those VIs to communicate with an instrument. The diagram above initializes the DMM with its VISA Alias, uses an Application Example VI to configure and read data from the meter, and closes the instrument, and then the error status is checked. You will see this same sequence of events in every application that uses an instrument driver. Notice how the Instrument Descriptor, VISA Sessions, and Error I/O terminals are wired. Remember that you can right click on the instrument driver VI terminals and choose Create Constant, Create Control, or Create Indicator as needed.

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 Serial Port Communication Serial communication is a popular means of transmitting data between a computer and a peripheral device such as a programmable instrument or even another computer. Serial communication uses a transmitter to send data, one bit at a time, over a single communication line to a receiver. You can use this method when data transfer rates are low or you must transfer data over long distances. Serial communication is popular because most computers have one or more serial ports, so no extra hardware is needed other than a cable to connect your instrument to the computer (or two computers together). Serial communication requires that you specify four parameters: the baud rate of the transmission, the number of data bits encoding a character, the sense of the optional parity bit, and the number of stop bits. Each transmitted character is packaged in a character frame that consists of a single start bit followed by the data bits. A typical character frame encoding the letter “m” is shown in the slide above. Baud rate is a measure of how fast data is moving between instruments that use serial communication. RS-232 uses only two voltage states, called MARK and SPACE. In such a two-state coding scheme, the baud rate is identical to the maximum number of bits of information, including “control” bits, that are transmitted per second. MARK is a negative voltage and SPACE is positive; the slide above shows how the idealized signal looks on an oscilloscope. The truth table for RS-232 is: Signal > +3 V = Signal < -3 V = 1 The output signal level usually swings between +12 V and -12 V. The “dead area” between +3 V and -3 V is designed to absorb line noise. 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 DTE DCE 1 DCD Input Output 2 RxD I O 3 TxD O I 4 DTR O I 5 Com - - 6 DSR I O 7 RTS O I 8 CTS I O 9 RI I O There are several recommended standards (RS) for serial communication. Each varies in hardware and software specifications. The students must be familiar with their instrument and what connector is used before you can begin controlling that device with their computer. There are three main Serial I/O types: RS-232—Connector found on most PCs. This is a single-ended communication method where only one device can be connected per port. Two connector types, 8- or 25-pin. Two configurations, DCE or DTE. RS-422—Connector found on most Macs. This is a differential communication method. Connector has 8 pins.

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 Instructor: See how many students are going to use or are interested in Serial I/O. Then cover the material in this and the next four slides accordingly. Go over the following Serial I/O terminology: Baud rate—How many bits per second are transferred on the serial cable. Data bits—How many bits represent a data value. Parity—Optional error checking bit that is added to the data. Stop bits—Certain number of bits added to the end of each data transfer. Flow control—Optional hardware or software handshaking parameters for communicating with a device.

42 Using the Instrument I/O Assistant with Serial
Select COMX as the instrument address Use the I/O Assistant as done with GPIB Use the I/O Assistant just like with GPIB communication.

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 Do not immediately display this slide. Suggested questions for class participation: What GPIB boards does LabVIEW support? What is the difference between GPIB and serial? What type of GPIB instruments will LabVIEW support? (488.2 and 488 instruments) What is VISA? Why use the Instrument I/O Assistant? What is the purpose of an instrument driver? What is the Instrument Wizard and how do you use it?

44 Lesson 11 VI Customization
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 SubVI Node Setup is used to set execution options for a single instance of a subVI. Does not affect other calls to that same subVI in the diagram. (VI Setup options affect every instance of that VI.)

50 Key Navigation Assigns keyboard strokes to front panel controls
Key Navigation can be accessed from the pop-up menu of any front panel control. The operation of the control can be associated with specific keys or key combinations. Not in course but mention if there is time: When running a VI, you can hit the tab key to enable key focus to the front panel controls To key focus inside arrays and clusters - use <ctrl>+down arrow (to step into array or cluster) and <ctrl>+up arrow (to step out of array or cluster). Then use tab to key focus each element.

51 Preventing Editing of a VI
Opens, runs, and closes LabVIEW without user intervention Remove menus, Abort button, etc… Save with Options Explain to the students that when you change the VI Setup options in a certain combination, they can make it almost impossible to edit their VI again. For example, Run When Opened, all menu bars and toolbars disabled, and Exit LabVIEW function. Show the Save with Options window and encourage the students to save a copy of their VIs (and the hierarchy) to a new location before they start modifying the VI Setup options. Point out that you can save VIs without diagrams and with passwords. CAUTION: Explain to your students the dangers of saving a VI without a diagram or with a password. Once you remove the diagram, that code is lost and cannot be recovered. This also means that that VI will only work in the version of LabVIEW in which it was created, in other words, you will not be able to open that VI in a future edition of LabVIEW. Additionally, there is no method for unlocking VIs for which you forget the password.

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 Do not show this slide immediately. Discussion questions: What is the difference between VI Setup and SubVI Node Setup? How do you make a subVI open its front panel when it is run? Why should you use the Save with Options before modifying your VI Setup options? How can you edit a VI that opens, runs, and closes or is locked? In what ways can you customize the Controls and Functions palettes? Review the summary slide.

53 Technical Support Resources
Award-Winning Website Drivers & Updates Product Manuals KnowledgeBases Example Code Tutorials Application Notes Discussion Forums

54 Info-LabVIEW Listserve
User-sponsored Internet mailing list Send subscription messages to the Info-LabVIEW list processor Send other administrative messages to the Info-LabVIEW list maintainer at Post a message to subscribers at B. Info-LabVIEW Listserve Info-LabVIEW is an group of users from around the world who discuss LabVIEW issues. The people on this list can answer questions about building LabVIEW systems for particular applications, about where to get instrument drivers or help with a device, and about problems that appear. Subscription and posting information is listed in the figure above. You may also want to search the ftp archives at ftp:// The archives contain a large set of donated VIs for doing a wide variety of tasks. User Support Newsgroups The National Instruments User Support Newsgroups are a collection of Usenet newsgroups covering National Instruments products as well as the general fields of science and engineering. You can read, search, and post to the newsgroups to share solutions and find additional support from other users. You can access the User Support Newsgroups from the National Instruments support Web page.

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 E. LabVIEW Publications LabVIEW Technical Resource (LTR) Newsletter Subscribe to LabVIEW Technical Resource to discover power tips and techniques for developing LabVIEW applications. This quarterly publication offers detailed technical information for novice users as well as advanced users. In addition, each issue includes a disk of LabVIEW VIs and utilities that implement methods covered in that issue. To order LabVIEW Technical Resource, call LTR publishing at (214) or visit LabVIEW Books The books listed above are just a few of the ones written about LabVIEW programming and applications. The National Instruments Web site contains a list of all the LabVIEW books and links to places to purchase these books. Publisher information is listed above so you can directly contact the publisher for more information on the contents and ordering information for these books.

Download ppt "Lesson 9 Data Acquisition and Waveforms"

Similar presentations

Ads by Google