Data Acquisition Toolbox

Transcription

Data AcquisitionToolboxFor Use with MATLAB ComputationVisualizationProgrammingUser’s GuideVersion 2

How to Contact The Newsgroupinfo@mathworks.comTechnical supportProduct enhancement suggestionsBug reportsDocumentation error reportsOrder status, license renewals, passcodesSales, pricing, and general information508-647-7000Phone508-647-7001FaxThe MathWorks, Inc.3 Apple Hill DriveNatick, MA athworks.comFor contact information about worldwide offices, see the MathWorks Web site.Data Acquisition Toolbox User’s Guide COPYRIGHT 1999 - 2002 by The MathWorks, Inc.The software described in this document is furnished under a license agreement. The software may be usedor copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc.FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation byor for the federal government of the United States. By accepting delivery of the Program, the governmenthereby agrees that this software qualifies as "commercial" computer software within the meaning of FARPart 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertainto the government’s use and disclosure of the Program and Documentation, and shall supersede anyconflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs oris inconsistent in any respect with federal procurement law, the government agrees to return the Programand Documentation, unused, to MathWorks.MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, andTargetBox is a trademark of The MathWorks, Inc.Other product or brand names are trademarks or registered trademarks of their respective holders.Printing History: May 1999November 2000June 2001July 2002First printingSecond printingThird printingOnline onlyNew for Version 1Revised for Version 2 (Release 12)Revised for Version 2.1 (Release 12.1)Revised for Version 2.2 (Release 13)

ContentsPrefaceWhat Is the Data Acquisition Toolbox? . . . . . . . . . . . . . . . . . . . xiiExploring the Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiRelated Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiiUsing This Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivExpected Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivUsing the Documentation Examples . . . . . . . . . . . . . . . . . . . . . . xvHow This Guide Is Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvInstallation Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiToolbox Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiHardware and Driver Installation . . . . . . . . . . . . . . . . . . . . . . xviiTypographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiiIntroduction to Data Acquisition1Anatomy of a Data Acquisition Experiment . . . . . . . . . . . . . 1-2The Data Acquisition System . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3Data Acquisition Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7Signal Conditioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10The Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12i

The Analog Input Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . .Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Quantization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Channel Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Transferring Data from Hardware to System Memory . . . . . .1-151-151-191-231-26Making Quality Measurements . . . . . . . . . . . . . . . . . . . . . . . .Accuracy and Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Matching the Sensor Range and A/D Converter Range . . . . . .How Fast Should a Signal Be Sampled? . . . . . . . . . . . . . . . . . .1-281-281-321-331-34Selected Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-38Getting Started with the Data Acquisition Toolbox2Toolbox Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .M-File Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Data Acquisition Engine . . . . . . . . . . . . . . . . . . . . . . . . . . .The Hardware Driver Adaptor . . . . . . . . . . . . . . . . . . . . . . . . . .2-22-32-42-7Accessing Your Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8Acquiring Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8Outputting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9Reading and Writing Digital Values . . . . . . . . . . . . . . . . . . . . . 2-10iiContentsUnderstanding the Toolbox Capabilities . . . . . . . . . . . . . . .The Contents M-File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Documentation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . .Demos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-122-122-122-132-13Examining Your Hardware Resources . . . . . . . . . . . . . . . . .General Toolbox Information . . . . . . . . . . . . . . . . . . . . . . . . . .Adaptor-Specific Information . . . . . . . . . . . . . . . . . . . . . . . . . .Device Object Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-172-172-182-19

Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20The daqhelp Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20The propinfo Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21The Data Acquisition Session3Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2Creating a Device Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4Creating an Array of Device Objects . . . . . . . . . . . . . . . . . . . . . . 3-5Where Do Device Objects Exist? . . . . . . . . . . . . . . . . . . . . . . . . . 3-6Adding Channels or Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8Mapping Hardware Channel IDs to MATLAB Indices . . . . . . . 3-9Configuring and Returning Properties . . . . . . . . . . . . . . . . .Property Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Returning Property Names and Property Values . . . . . . . . . .Configuring Property Values . . . . . . . . . . . . . . . . . . . . . . . . . . .Specifying Property Names . . . . . . . . . . . . . . . . . . . . . . . . . . . .Default Property Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Data Acquisition Property Editor . . . . . . . . . . . . . . . . . . .3-123-123-143-183-193-193-20Acquiring and Outputting Data . . . . . . . . . . . . . . . . . . . . . . .Starting the Device Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Logging or Sending Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Stopping the Device Object . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-223-233-233-24Cleaning Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25iii

Getting Started with Analog Input4Creating an Analog Input Object . . . . . . . . . . . . . . . . . . . . . . . 4-2Adding Channels to an Analog Input Object . . . . . . . . . . . . . 4-3Referencing Individual Hardware Channels . . . . . . . . . . . . . . . 4-5Example: Adding Channels for a Sound Card . . . . . . . . . . . . . . 4-6Configuring Analog Input Properties . . . . . . . . . . . . . . . . . . . 4-8The Sampling Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8Trigger Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10The Samples to Acquire per Trigger . . . . . . . . . . . . . . . . . . . . . 4-11Acquiring Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Starting the Analog Input Object . . . . . . . . . . . . . . . . . . . . . . .Logging Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Stopping the Analog Input Object . . . . . . . . . . . . . . . . . . . . . . .4-124-124-134-13Analog Input Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14Acquiring Data with a Sound Card . . . . . . . . . . . . . . . . . . . . . . 4-14Acquiring Data with a National Instruments Board . . . . . . . . 4-18Evaluating the Analog Input Object Status . . . . . . . . . . . . . 4-21Status Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21The Display Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22Doing More with Analog Input5Configuring and Sampling Input Channels . . . . . . . . . . . . . .Input Channel Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . .Sampling Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Channel Skew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ivContents5-25-35-55-6

Managing Acquired Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8Previewing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8Extracting Data from the Engine . . . . . . . . . . . . . . . . . . . . . . . 5-12Returning Time Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17Configuring Analog Input Triggers . . . . . . . . . . . . . . . . . . . .Defining a Trigger: Trigger Types and Conditions . . . . . . . . .Executing the Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Trigger Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Repeating Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .How Many Triggers Occurred? . . . . . . . . . . . . . . . . . . . . . . . . .When Did the Trigger Occur? . . . . . . . . . . . . . . . . . . . . . . . . . .Device-Specific Hardware Triggers . . . . . . . . . . . . . . . . . . . . . .5-195-205-255-255-295-355-365-36Events and Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Event Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Recording and Retrieving Event Information . . . . . . . . . . . . .Creating and Executing Callback Functions . . . . . . . . . . . . . .Examples: Using Callback Properties and Functions . . . . . . .5-455-455-485-515-52Linearly Scaling the Data: Engineering Units . . . . . . . . . . . 5-55Example: Performing a Linear Conversion . . . . . . . . . . . . . . . 5-56Analog Output6Getting Started with Analog Output . . . . . . . . . . . . . . . . . . . . 6-2Creating an Analog Output Object . . . . . . . . . . . . . . . . . . . . . . . 6-2Adding Channels to an Analog Output Object . . . . . . . . . . . . . . 6-3Configuring Analog Output Properties . . . . . . . . . . . . . . . . . . . . 6-5Outputting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8Analog Output Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9Evaluating the Analog Output Object Status . . . . . . . . . . . . . 6-13Managing Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16Queuing Data with putdata . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16Example: Queuing Data with putdata . . . . . . . . . . . . . . . . . . . 6-18v

Configuring Analog Output Triggers . . . . . . . . . . . . . . . . . . .Defining a Trigger: Trigger Types . . . . . . . . . . . . . . . . . . . . . . .Executing the Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .How Many Triggers Occurred? . . . . . . . . . . . . . . . . . . . . . . . . .When Did the Trigger Occur? . . . . . . . . . . . . . . . . . . . . . . . . . .Device-Specific Hardware Triggers . . . . . . . . . . . . . . . . . . . . . .6-206-216-226-226-236-24Events and Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Event Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Recording and Retrieving Event Information . . . . . . . . . . . . .Examples: Using Callback Properties and Callback Functions6-266-266-286-31Linearly Scaling the Data: Engineering Units . . . . . . . . . . . 6-34Example: Performing a Linear Conversion . . . . . . . . . . . . . . . 6-35Starting Multiple Device Objects . . . . . . . . . . . . . . . . . . . . . . 6-37Digital Input/Output7Creating a Digital I/O Object . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2The Parallel Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3Adding Lines to a Digital I/O Object . . . . . . . . . . . . . . . . . . . . . 7-4Line and Port Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5Referencing Individual Hardware Lines . . . . . . . . . . . . . . . . . . 7-9viContentsWriting and Reading Digital I/O Line Values . . . . . . . . . . . .Writing Digital Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reading Digital Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Example: Writing and Reading Digital Values . . . . . . . . . . . .7-127-127-147-15Generating Timer Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Timer Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Starting and Stopping a Digital I/O Object . . . . . . . . . . . . . . .Example: Generating Timer Events . . . . . . . . . . . . . . . . . . . . .7-177-177-187-19

Evaluating the Digital I/O Object Status . . . . . . . . . . . . . . . . 7-20The Display Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20Saving and Loading the Session8Saving and Loading Device Objects . . . . . . . . . . . . . . . . . . . . . 8-2Saving Device Objects to an M-File . . . . . . . . . . . . . . . . . . . . . . 8-2Saving Device Objects to a MAT-File . . . . . . . . . . . . . . . . . . . . . 8-4Logging Information to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . .Specifying a Filename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Retrieving Logged Information . . . . . . . . . . . . . . . . . . . . . . . . . .Example: Logging and Retrieving Information . . . . . . . . . . . . .8-58-68-78-9softscope: The Data Acquisition Oscilloscope9Opening the Oscilloscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2Hardware Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3Displaying Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4Creating Additional Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5Configuring Display Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6Math and Reference Channels . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7Removing Channel Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10Scaling the Channel Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11Configuring Channel Properties . . . . . . . . . . . . . . . . . . . . . . . . 9-12Triggering the Oscilloscope . . . . . . . . . . . . . . . . . . . . . . . . . . .Acquisition Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Trigger Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Configuring Trigger Properties . . . . . . . . . . . . . . . . . . . . . . . . .9-149-149-149-16vii

Making Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Defining a Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Defining a New Measurement Type . . . . . . . . . . . . . . . . . . . . .Configuring Measurement Properties . . . . . . . . . . . . . . . . . . .9-179-189-199-20Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24Saving and Loading the Oscilloscope Configuration . . . . . 9-25Function Reference10Getting Command Line Function Help . . . . . . . . . . . . . . . . . 10-2Functions – By Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3Functions – Alphabetical List . . . . . . . . . . . . . . . . . . . . . . . . . 10-7Base Property Reference11Getting Command Line Property Help . . . . . . . . . . . . . . . . . 11-2Properties – By Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3Analog Input Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3Analog Output Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8Digital I/O Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12Properties – Alphabetical List . . . . . . . . . . . . . . . . . . . . . . . . 11-14viii Contents

Device-Specific Property Reference12Getting Command Line Property Help . . . . . . . . . . . . . . . . . 12-2Properties – By Vendor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Agilent Technologies Properties . . . . . . . . . . . . . . . . . . . . . . . .Keithley Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Measurement Computing Properties . . . . . . . . . . . . . . . . . . . .National Instruments Properties . . . . . . . . . . . . . . . . . . . . . . .Parallel Port Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Sound Card Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-312-312-412-512-512-612-6Properties – Alphabetical List . . . . . . . . . . . . . . . . . . . . . . . . . 12-7Troubleshooting Your HardwareAAgilent Technologies Hardware . . . . . . . . . . . . . . . . . . . . . . . . A-2What Driver Are You Using? . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2Is Your Hardware Functioning Properly? . . . . . . . . . . . . . . . . . A-3Measurement Computing Hardware . . . . . . . . . . . . . . . . . . . . A-5What Driver Are You Using? . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-5Is Your Hardware Functioning Properly? . . . . . . . . . . . . . . . . . A-7National Instruments Hardware . . . . . . . . . . . . . . . . . . . . . . . . A-8What Driver Are You Using? . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8Is Your Hardware Functioning Properly? . . . . . . . . . . . . . . . . A-10Sound Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Microphone and Sound Card Types . . . . . . . . . . . . . . . . . . . . .Testing with a Microphone . . . . . . . . . . . . . . . . . . . . . . . . . . . .Testing with a CD Player . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Running in Full Duplex Mode . . . . . . . . . . . . . . . . . . . . . . . . . .A-11A-14A-15A-15A-17ix

Other Things to Try . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-18Registering the Hardware Driver Adaptor . . . . . . . . . . . . . . . . A-18Contacting The MathWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . A-19Managing Your Memory ResourcesBMemory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2How Much Memory Do You Need? . . . . . . . . . . . . . . . . . . . . . . B-3Example: Managing Memory Resources . . . . . . . . . . . . . . . . . B-4GlossaryCIndexxContents

PrefaceThis chapter provides a brief overview of the Data Acquisition Toolbox, as well as information aboutthis documentation set. The sections are as follows.What Is the Data Acquisition The toolbox and the kinds of tasks it can performToolbox? (p. xii)Related Products (p. xiii)MathWorks products related to this toolboxUsing This Guide (p. xiv)An overview of this guideInstallation Information(p. xvii)How to determine whether the toolbox is installed on your systemTypographical Conventions(p. xviii)Typographical conventions that this guide uses

PrefaceWhat Is the Data Acquisition Toolbox?The Data Acquisition Toolbox is a collection of M-file functions and MEX-filedynamic link libraries (DLLs) built on the MATLAB technical computingenvironment. The toolbox provides you with these main features: A framework for bringing live, measured data into MATLAB usingPC-compatible, plug-in data acquisition hardware Support for analog input (AI), analog output (AO), and digital I/O (DIO)subsystems including simultaneous analog I/O conversions Support for these popular hardware vendors/devices:- Agilent Technologies E1432A/33A/34A VXI modules- Keithley boards that use DriverLINX drivers.- Measurement Computing Corporation (ComputerBoards) boards- National Instruments boards that use NI-DAQ software (except SCXI)- Parallel ports LPT1–LPT3- Windows sound cardsAdditionally, you can use the Data Acquisition Toolbox Adaptor Kit tointerface unsupported hardware devices to the toolbox. Event-driven acquisitionsExploring the ToolboxA list of the toolbox functions is available to you by typinghelp daqYou can view the code for any function by typingtype function nameYou can view the help for any function by typingdaqhelp function nameYou can change the way any toolbox function works by copying and renamingthe M-file, then modifying your copy. You can also extend the toolbox by addingyour own M-files, or by using it in combination with other products such as theSignal Processing Toolbox or the Instrument Control Toolbox.xii

Related ProductsRelated ProductsThe MathWorks provides several related products that are especially relevantto the kinds of tasks you can perform with the Data Acquisition Toolbox. Formore information about any of these products, see either The online documentation for that product if it is installed or if you arereading the documentation from the CD The MathWorks Web site, at http://www.mathworks.com; see the “products”sectionThe toolboxes listed below all include functions that extend the capabilities ofMATLAB.ProductDescriptionControl System ToolboxDesign and analyze feedback control systemsDatabase ToolboxExchange data with relational databasesInstrument ControlToolboxControl and communicate with test andmeasurement instrumentsMATLAB ReportGeneratorAutomatically generate documentation forMATLAB applications and dataNeural Network ToolboxDesign and simulate neural networksSignal ProcessingToolboxPerform signal processing, analysis, andalgorithm developmentStatistics ToolboxApply statistical algorithms and probabilitymodelsSystem IdentificationToolboxCreate linear dynamic models from measuredinput-output dataWavelet ToolboxAnalyze, compress, and denoise signals andimages using wavelet techniquesxiii

PrefaceUsing This GuideExpected BackgroundTo use the Data Acquisition Toolbox, you should have some familiarity with The basic features of MATLAB The capabilities of your hardware device The basic concepts associated with acquiring live, measured dataIf You Are a New UserFor a brief review of basic data acquisition concepts, you should start withChapter 1, “Introduction to Data Acquisition.” Otherwise, start with Chapter2, “Getting Started with the Data Acquisition Toolbox,” which provides simpleexamples that illustrate how to input and output data. Then read theappropriate chapter based on the hardware subsystem you are using. Forexample, if you are acquiring data with an analog input subsystem, you shouldread Chapter 4, “Getting Started with Analog Input.”After you have successfully transferred data between your hardware deviceand MATLAB, you should read the appropriate reference material as needed.If you want detailed information about a specific function, refer to Chapter 10,“Function Reference.” If you want detailed information about a specificproperty, refer to Chapter 11, “Base Property Reference,” or Chapter 12,“Device-Specific Property Reference.”If You Are an Experienced UserStart with the Data Acquisition Toolbox Release Notes for a description of newand modified toolbox features.You should then read the appropriate reference material as needed. If youwant detailed information about a specific function, refer to Chapter 10,“Function Reference.” If you want detailed information about a specificproperty, refer to Chapter 11, “Base Property Reference,” or Chapter 12,“Device-Specific Property Reference.”xiv

Using This GuideUsing the Documentation ExamplesWhen you encounter examples or code snippets in this book, you might want totry them for yourself. An easy way to do this is to cut the relevant text from thePDF or HTML versions of this guide and paste it into the MATLAB workspace.You access the PDF and HTML content with the Help browser.Some examples are constructed as mini-applications that illustrate one or twoimportant toolbox features, and serve as templates so you can see how to buildapplications that suit your specific needs. These examples are included astoolbox M-files and are treated as demos. You can list all Data AcquisitionToolbox demos by typinghelp daqdemosAll documentation example M-files begin with daqdoc. To run an example, typethe M-file name at the command line. Note that most examples are written forspecific hardware devices. To use these examples with your hardware device,you should modify the creation function input arguments and the device objectproperty values as needed.How This Guide Is OrganizedThe organization of this guide is described below.ChapterDescriptionIntroduction to DataAcquisitionProvides you with general information aboutmaking measurements with data acquisitionhardware. The topics covered should help youunderstand the specification sheet associatedwith your hardware.Getting Started withthe Data AcquisitionToolboxDescribes the toolbox components, and showsyou how to access your hardware, examine yourhardware resources, and get command linehelp.The Data AcquisitionSessionDescribes all the steps you are likely to takewhen acquiring or outputting data.xv

PrefacexviChapterDescriptionGetting Started withAnalog InputShows you how to perform basic dataacquisition tasks using your analog inputsubsystem.Doing More with AnalogInputPresents the complete analog inputfunctionality.Analog OutputShows you how to perform data acquisitiontasks using your analog output subsystem.Digital Input/OutputShows you how to perform data acquisitiontasks using your digital I/O subsystem.Saving and Loading theSessionShows you how to save and load device objects,data, and event information using several diskfile formats.softscope: The DataAcquisition OscilloscopeAn interactive graphical user interface (GUI)for streaming data into a displayFunction ReferencePresents a complete description of all toolboxfunctions.Base PropertyReferencePresents a complete description of all toolboxbase properties.Device-Specific PropertyReferencePresents a complete description of all toolboxdevice-specific properties.Troubleshooting YourHardwarePresents tips to help you troubleshoot yourhardware.Managing Your MemoryResourcesDescribes how to allocate and return memoryresources.GlossaryProvides a description of data acquisitionterms.

Installation InformationInstallation InformationTo acquire live, measured data into the MATLAB environment, or to outputdata from the MATLAB environment, you must install these components: MATLAB 6.5 (Release 13) The Data Acquisition Toolbox A supported data acquisition device — for a complete listing of all supporteddevices, visit the Data Acquisition Toolbox section of the MathWorks Website at http://www.mathworks.com/products/daq/ Software such as drivers and support libraries, as required by your dataacquisition deviceToolbox InstallationTo determine if the Data Acquisition Toolbox is installed on your system, typeverat the MATLAB prompt. MATLAB displays information about the versions ofMATLAB you are running, including a list of installed add-on products andtheir version numbers. Check the list to see if the Data Acquisition Toolboxappears. For information about installing the toolbox, see the MATLABInstallation Guide for your platform.If you experience installation difficulties and have Web access, look for thelicense manager and installation information at the MathWorks Web site(http://www.mathworks.com).Hardware and Driver InstallationInstallation of your hardware device, hardware drivers, and any otherdevice-specific software is described in the documentation provided by yourhardware vendor.Note You need to install all necessary device-specific software provided byyour hardware vendor in addition to the Data Acquisition Toolbox.xvii

PrefaceTypographical ConventionsThis manual uses some or all of these conventions.ItemConventionExampleExample cod

What Is the Data Acquisition Toolbox? The Data Acquisition Toolbox is a collection of M-file functions and MEX-file dynamic link libraries (DLLs) built on the MATLAB technical computing environment. The toolbox provides you with these main features: A framework for bringing live, measur