Instrument Control Toolbox 2 Control and Communicate with Test and Measurement Instruments
Total Page:16
File Type:pdf, Size:1020Kb
Instrument Control Toolbox 2 Control and communicate with test and measurement instruments The Instrument Control Toolbox lets you com- municate with instruments, such as oscilloscopes, function generators, and analytical instruments, directly from MATLAB®. With the toolbox, you KEY FEATURES can generate data in MATLAB to send out to ■ Instrument driver support for IVI, VXIplug&play, and an instrument, or read data into MATLAB for MATLAB instrument drivers analysis and visualization. ■ Support for GPIB and VISA standard protocols (GPIB, The toolbox provides a consistent interface to GPIB-VXI, VXI, USB, TCP/IP, serial) all devices independent of hardware manufac- turer, protocol, or driver. The toolbox supports ■ Support for networked instruments using the TCP/IP and IVI, VXIplug&play, and MATLAB instrument UDP protocols drivers. Support is also provided for GPIB, VISA, ■ Graphical user interface for identifying, configuring, and com- TCP/IP, and UDP communication protocols. municating with instruments Working with the Instrument Control ■ Hardware availability, management, and configuration tools Toolbox ■ Instrument driver development and testing tools The Instrument Control Toolbox provides a variety of ways to communicate with instru- ■ Functions for reading and writing binary and text (ASCII) data ments, including: ■ Synchronous and asynchronous (blocking and nonblocking) • Instrument drivers read-and-write operations • Communication protocols ■ Event handling for time-out, bytes read, data written, • Graphical user interface (TMTool) and other events The Instrument Control Toolbox is based ■ Recording of data transferred to and from instruments on MATLAB object technology. The toolbox includes functions for creating objects that contain properties related to your instrument and to your instrument control session. For demos, application examples, Instrument Drivers tutorials, user stories, and pricing: Instrument drivers let you communicate with • Visit www.mathworks.com an instrument independent of device protocol. • Contact The MathWorks directly As a result, you can use common MATLAB US & Canada 508-647-7000 terminology to communicate with instruments Benelux +31 (0)182 53 76 44 without learning instrument-specific commands, France +33 (0)1 41 14 67 14 Germany +49 (0)241 470 750 such as Standard Commands for Programmable Italy +39 (011) 2274 700 Instruments (SCPI). Korea +82 (0)2 6006 5114 Spain +34 93 362 13 00 The toolbox lets you work with VXIplug&play, Sweden +46 (8)505 317 00 IVI, and MATLAB instrument drivers. Switzerland +41 (0)31 950 60 20 UK +44 (0)1223 423 200 VXIplug&play and IVI instrument drivers Visit www.mathworks.com to obtain often ship with your instrument and are also contact information for authorized available from the instrument manufacturers’ A typical test setup showing the Instrument Control Toolbox MathWorks representatives in countries Web sites. You can also create MATLAB instru- throughout Asia Pacific, Latin America, controlling and communicating with a power supply and the Middle East, Africa, and the rest ment drivers with driver development tools of Europe. provided in the Instrument Control Toolbox. oscilloscope. Resulting data is read into MATLAB for analysis and visualization. Communication Protocols The Instrument Control Toolbox supports communication protocols, including GPIB, serial, TCP/IP, and UDP, for directly com- municating with instruments. You can also communicate with instruments using VISA over GPIB, VXI, USB, TCP/IP, and serial buses. The toolbox provides a set of M-file functions for creating and working with instruments. These functions let you write commands to your instrument or read data from your instrument for use in MATLAB. The toolbox supports the text commands used by your instrument, such as SCPI. The transferred data can be binary or ASCII. TMTool TMTool, a graphical user interface, lets you search for available hardware and drivers and communicate with You can communicate with and configure and control instruments without writing code. TMTool can automatically generate M-code from your session. your instruments without writing code using TMTool, a GUI that enables programmers drivers. You can add and remove hardware MATLAB workspace when all the data has and nonprogrammers to: assets and logical names and display available been written to the instrument. The toolbox • Search for available hardware IVI driver information. supports many event conditions, such as: • Connect to an instrument You can access these management and con- • Errors • Configure instrument settings figuration functions using M-file functions • Timers • Write data to an instrument or TMTool. • Bytes available • Read data from an instrument • Output buffer empty Support for Synchronous and Asynchronous TMTool automatically generates M-code Modes Data Recording from your instrument control session. By The Instrument Control Toolbox sup- The Instrument Control Toolbox includes saving this code to an M-file, you can execute ports both synchronous and asynchronous functions for recording your instrument the same commands programmatically. read-and-write operations. A synchronous control session to disk files. You can record: operation blocks access to the command line Managing Your Instrument Control Session • Data written to instruments until the read or write is completed. An asyn- • Data read from instruments Hardware Detection, Management, chronous operation lets you issue additional • Event information and Configuration MATLAB commands while the read or write The Instrument Control Toolbox provides operation executes. Developing and Modifying Instrument a set of utility functions that enable you to Event Handling Drivers easily determine hardware availability for An event, which occurs at a particular time your test setup. Using the provided functions, Creating and Testing Instrument Drivers after a condition is met, may execute a specified the toolbox will scan for all available hard- The Instrument Control Toolbox provides a function, known as a callback. The Instrument ware connected to your system. set of graphical tools for creating and testing Control Toolbox lets you use events and call- MATLAB instrument drivers and for working The toolbox also lets you configure IVI backs to analyze data as it is received from with IVI and VXIplug&play drivers. Configuration store information for your IVI the instrument or to display a message to the Using TMTool GUI, a Tektronix TDS 2024 driver is imported and then extended to accept multiple coupling types for the main edge trigger. To work with VXIplug&play and IVI instru- The MATLAB Instrument Driver Testing Tool You can also include MATLAB code to ment drivers, a MATLAB instrument driver provides a graphical environment for creating determine which commands are sent to the wrapper is required for the underlying a test to verify the functionality of a MATLAB instrument or to perform analysis on data driver. You can create these drivers using instrument driver. It also lets you: returned from the instrument. For example, the provided tools. You can also download you can request that a meter run its self-cali- • Verify property behavior preconfigured wrappers and MATLAB instru- bration and return the status as a result. You • Verify function behavior ment drivers from the MathWorks Web site. can also read a meter’s scaling, request a mea- • Save the test as M-code surement, adjust the measured data according The MATLAB Instrument Driver Editor • Export the test results to the MATLAB work- to the scale reading, and then return the result. Tool lets you create MATLAB instrument space, a figure window, a MAT-file, or the drivers and wrappers for VXIplug play MATLAB Array Editor & Supported Drivers and Interfaces and IVI instrument drivers. The MATLAB • Save test results as an HTML page The Instrument Control Toolbox supports Instrument Driver Editor Tool also lets you: Adding Analysis Capabilities to Instrument Drivers IVI, VXIplug&play, and MATLAB instrument • Import existing drivers for editing and The Instrument Control Toolbox lets you drivers. modification modify instrument drivers to call MATLAB The toolbox also lets you communicate with • Configure and define instrument-specific analysis functions. As a result, you can instruments using the following protocols: properties configure the instrument to perform tasks • Document properties and functions that return results as text or numeric data. • GPIB (HPIB, IEEE-488) interfaces • Customize the behavior of your instrument VXIplug&play, IVI, and MATLAB instrument from Agilent Technologies, Capital drivers can be extended to incorporate a single Equipment Corporation (CEC), CONTEC, command to the instrument or a sequence of ICS Electronics, IOTech, Keithley, instrument commands. Measurement Computing Corp. (for- merly ComputerBoards), and National Instruments % Create a device object to communicate with the instrument d = icdevice(‘tektronix_tds2024’, gpib(‘ni’,0, 1)); % Connect to the instrument connect(d); % Get information about the instrument d % Configure the trigger slope to be falling set(d, ‘TriggerSlope’, ‘falling’); % Get information about the waveform and the device object waveform_1 = get(d, ‘Waveform’); 90 80 % Get the waveform data from channel 1 of the oscilloscope 70 [y, x] = invoke(waveform_1, ‘getWaveform’, ‘Channel1’); 60 Volts % Generate a plot of the waveform 50 plot(x, y); 40 xlabel(‘Time(sec)’); ylabel(‘Volts’) 30 20 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5 Time(sec)