background image

© National Instruments Corporation

6-1

Measure Data Acquisition User Manual

Using Measure Data

Acquisition Tasks with VBA

This chapter describes how to run tasks from within Visual Basic for Applications.
There are two ways to execute DAQ Add-In functions in a VBA module.

1.

Indirectly, you can use 

Application.Run

returnValue=Application.Run(“FuncName”, arg1)

Application.Run “FuncName”, arg1

2.   Directly, after you add a reference to the DAQ Add-In.  To add a reference to the

DAQ Add-In, select Tools»References and select the checkbox next to the Data
Acquisition Add-In.

returnValue = FuncName(arg1)

FuncName arg1

Function Reference

The DAQ Add-In has one function that you can call to run a task that has been
configured already and one function to translate an error code to an error description.

DAQ

Runs the task named 

TaskName

.

Syntax

Function DAQ(

TaskName

 as String, [

NewTargetRange

 as String],

[

ReferenceStyle

 as Variant]) as Integer

Содержание Measure Data Acquisition

Страница 1: ...l August 1996 Edition Part Number 321004B 01 Copyright 1995 1996 National Instruments Corporation All rights reserved Click here to comment on this document via the National Instruments website at htt...

Страница 2: ...ralia 03 9 879 9422 Austria 0662 45 79 90 0 Belgium 02 757 00 20 Canada Ontario 519 622 9310 Canada Quebec 514 694 8521 Denmark 45 76 26 00 Finland 90 527 2321 France 1 48 14 24 24 Germany 089 741 31...

Страница 3: ...ardless of the form of action whether in contract or tort including negligence Any action against National Instruments must be brought within one year after the cause of action accrues National Instru...

Страница 4: ...verview Installing Measure Manually Adding or Removing the DAQ Add In Uninstalling Measure Chapter 2 Getting Started with Data Acquisition Tasks Selecting a Data Acquisition Task Configuring an Analog...

Страница 5: ...ck Display At cell In Columns In Rows Trigger Reference Mode Reference Advanced Timing Settings Chapter 5 Analog Output Reference Analog Output Configuration Overview Advanced Configuration Chapter 6...

Страница 6: ...Box Figure 2 5 Analog Output Configuration Dialog Box Figure 2 6 DAQ Tasks Dialog Box Figure 2 7 Adding Tasks to the DAQ Menu Figure 2 8 The DAQ Menu Figure 2 9 DAQ Tasks Dialog Box Figure 3 1 Selecti...

Страница 7: ...ogrammability MIO and AI Devices Table A 2 Analog Input Characteristics MIO and AI Devices Part 1 Table A 3 Analog Input Characteristics MIO and AI Devices Part 2 Table A 4 Analog Output Characteristi...

Страница 8: ...Acquisition Tasks contains a tutorial for the following basic functions Selecting a data acquisition task configuring an analog input task configuring an analog output task adding tasks to the DAQ me...

Страница 9: ...ing the Measure DAQ Add In Appendix D Customer Communication contains forms you can use to request help from National Instruments or to comment on our products and manuals The Glossary contains an alp...

Страница 10: ...ects you to pull down the File menu select the Page Setup item select Options and finally select the Substitute Fonts option from the last dialog box Note This icon to the left of bold italicized text...

Страница 11: ...e that came with your DAQ device NI DAQ is the low level driver software that controls your DAQ device Measure is a higher level software development tool that communicates to your DAQ device through...

Страница 12: ...once you define it The following pages contain a tutorial to show you how to use Measure Refer to the Managing Tasks in a Workbook section in Chapter 2 Getting Started with Data Acquisition Tasks for...

Страница 13: ...re Data Acquisition Add In entry If you cannot find the entry click the Browse button and look for DAQ XLA in the directory where you installed Measure To remove the DAQ Add In manually deselect the c...

Страница 14: ...Acquisition task Configuring an Analog Input task Configuring an Analog Output task Adding tasks to the DAQ menu Saving tasks Managing tasks in a workbook You only need to read the sections for the f...

Страница 15: ...tasks and run I O tasks interactively to test their operation 3 Select a DAQ device from the Data acquisition device drop down listbox at the top of the dialog box The list of devices available in the...

Страница 16: ...top of the dialog box is where you specify the input channels on your DAQ device from which you would like to acquire data For each input channel you add to the scan list you must specify a high and...

Страница 17: ...field 4 The Display section of the dialog box is where you specify the cells on your worksheet to contain the acquired data You manually can type in a spreadsheet address such as A 1 or you can highli...

Страница 18: ...Run button to execute the task When the task completes there are 100 datapoints in column A of your worksheet Configuring an Analog Output Task If your DAQ device has analog output channels you can u...

Страница 19: ...s analog output values 4 Click on the Add button 5 Type 10 in the Number of iterations input field The number of iterations determines how many times Measure outputs the values specified in the cell r...

Страница 20: ...and click on the Run button to execute the analog output task Make sure you have valid voltage data in cells A1 A10 before running the task Adding Tasks to the DAQ Menu Now that the two tasks are con...

Страница 21: ...he OK button to return to the Excel worksheet 5 Pull down the DAQ menu Notice that two new entries now appear in the DAQ menu shown in Figure 2 8 Now you can select these tasks and execute them from t...

Страница 22: ...time you launch Excel and open a workbook that contains Measure tasks they appear in the task list of the DAQ tasks dialog box Managing Tasks in a Workbook This section describes how to use the DAQ T...

Страница 23: ...t a task if you wish to run edit or delete it Task Description Measure displays the description of the selected task You can assign a description to a task when you create or edit it Edit Menu Add or...

Страница 24: ...XI modules In most cases your DAQ device is a plug in board in your computer although it also can be a PC Card PCMCIA format DAQCard or a SCXI 1200 module You use the DAQ devices for the actual A D co...

Страница 25: ...ield by entering a channel string This channel string provides information about the DAQ device channel SCXI chassis number SCXI module number and SCXI channel number The channel string has the follow...

Страница 26: ...on device to acquire Each channel on your DAQ device is mapped in hardware to one channel on a SCXI module in parallel mode Multiple SCXI Modules and Chassis In the scan list of your DAQ AI task you c...

Страница 27: ...0 7 ob0 sc1 md4 5 12 Channels 0 7 on module 2 and channels 5 12 on module 4 of chassis 1 are read through onboard channel 0 ob0 sc1 md3 3 4 ob1 sc2 md1 20 24 Channels 3 and 4 of module 3 of chassis 1...

Страница 28: ...User Manual SCXI Analog Output The current version of Measure does not support the use of analog output AO channels on the SCXI 1124 module You can use the analog output channels of the SCXI 1200 mod...

Страница 29: ...nd reference information about using Measure for analog input operations Many of the parameters that you can set up with Measure vary depending on your DAQ device For example DAQ devices vary in acqui...

Страница 30: ...onfigure an acquisition first you must select the channels that you want to scan by entering a channel string in the Channels field A scan is one acquisition or reading from each channel in the Analog...

Страница 31: ...second slot of the first chassis and 5 6 7 8 on the SCXI module in the third slot of the second chassis For more information about using SCXI refer to Chapter 3 Using SCXI with Measure DAQ Note Some d...

Страница 32: ...each channel Scale to volts Select this option if you want Measure to display the acquired data in volts Otherwise Measure displays the data as the binary values read from the analog to digital conver...

Страница 33: ...obin scanning Round robin scanning means that the interval between the last channel in one scan and the first channel of the following scan is the same as the interval between any two channels in the...

Страница 34: ...column headed by cell B5 and so on At cell Specify the target range of the acquired data Either explicitly type the cell address or highlight the text in this field and select a cell on any worksheet...

Страница 35: ...task description in the Excel status bar at the bottom of its window when you select the task in the menu OK Verify configuration and add a new task or update an existing task in the data acquisition...

Страница 36: ...ur acquisition on the rising edge of the PFI1 EXTTRIG STOPTRIG depending on the board you are using signal on the connector Otherwise the acquisition ends after Measure acquires all the scans scans af...

Страница 37: ...tive input of the amplifier is internally tied to analog input ground AIGND Refer to the user manual for your DAQ device for more information about input modes available on your device Non Referenced...

Страница 38: ...dvanced Timing Settings dialog box shown in Figure 4 6 Figure 4 6 Advanced Timing Settings Option Table 4 5 contains a list of the Advanced timing settings with descriptions of their use Table 4 5 Cho...

Страница 39: ...rence for basic and advanced Analog Output Configuration You should be familiar with the hardware capabilities of your data acquisition device Analog Output Configuration Overview To configure an anal...

Страница 40: ...iterations Measure indefinitely iterates through the waveform until you run another signal generation task on that same device or until you exit Excel Updates per second Specify the rate at which Mea...

Страница 41: ...s larger than for another channel in the scan list the shorter range of data is padded with the value 0 when Measure generates the waveforms Advanced Configuration For most of your tasks you do not ne...

Страница 42: ...the following equation Imax Vref 2 5 0 625 mA The following list contains the default settings for high limit If you want to use a high limit that differs from the ones given in this list you must sup...

Страница 43: ...cation Run FuncName arg1 2 Directly after you add a reference to the DAQ Add In To add a reference to the DAQ Add In select Tools References and select the checkbox next to the Data Acquisition Add In...

Страница 44: ...Measure uses the previously configured range ReferenceStyle Use either xlA1 or xlR1C1 to indicate the type of range address being passed into NewTargetRange If this parameter is missing then Excel s c...

Страница 45: ...and returns a description of an error code returned by the DAQ function Syntax Function GetDAQErrorMessage ErrorCode As Integer As String Parameters Option Description ErrorCode A non zero number ret...

Страница 46: ...Series and Portable Devices SCXI Modules Analog Output Only Devices SCXI Information You cannot use the SCXI Analog Output Module SCXI 1124 with Measure Measure works with all Data Acquisition devices...

Страница 47: ...of Channels Resolution Gains 1 Range V 1 Input FIFO words Scanning 2 AT MIO 16E 1 AT MIO 16E 2 AT MIO 16E 10 AT MIO 16DE 10 NEC MIO 16E 4 NEC AI 16E 4 16SE 8DI 12 bits 0 5 1 2 5 10 20 50 100 5 0 to 10...

Страница 48: ...T MIO 16X AT MIO 16 16D Pre Post 100 k 1 Pre Pretrigger Post Posttrigger Table A 4 Analog Output Characteristics MIO and AI Devices Device Channel Numbers DAC Type Output Limits V Waveform Grouping Al...

Страница 49: ...group By group By group DC DAQCard 500 1 Only 1 range available Bipolar SE DC DAQCard 700 1 By group Bipolar By group DC PC LPM 16 1 By device Bipolar SE DC Note By device means you select the value...

Страница 50: ...1 5 2 5 0 to 10 0 to 5 16 1 You can determine the limit settings of your device by dividing the range by the desired gain Table A 7 Analog Input Characteristics Lab 1200 Series Portable Devices Part 2...

Страница 51: ...500 1 000 2 000 SW M 1 lowpass filter or no filter with 10 kHz or 4 Hz cutoff frequency JS M 1 multiplexed SCXI 1102 32 DI 10 1 100 SW C 1 1 Hz lowpass on each channel multiplexed SCXI 1120 SCXI 1121...

Страница 52: ...ctable per module 2 The SCXI 1141 has an automatic filter setting NI DAQ sets the filter frequency based on the scan rates used with the module Table A 10 Terminal Block Selection Guide SCXI Modules S...

Страница 53: ...0 through 5 6 through 9 12 bit double buffered with 1 K FIFO for update clock 1 channels 10V Vref1 0 to 10 0 to Vref1 4 to 20 mA 4 to Vref mA 1 2 5 0 625 For update clock 1 channels are any one chann...

Страница 54: ...was correct but certain values specified in the string were inconsistent with other values specified in the string 10003 invalidValueErr The value of a numeric parameter is invalid 10004 valueConflic...

Страница 55: ...itErr The time limit is invalid 10016 badReadCountErr The read count is invalid 10017 badReadModeErr The read mode is invalid 10018 badReadOffsetErr The offset is unreachable 10019 badClkFrequencyErr...

Страница 56: ...with the serial port is not valid on this platform 10031 badChassisIDError The specified SCXI chassis does not correspond to a configured SCXI chassis 10032 badModuleSlotError The SCXI module slot th...

Страница 57: ...ecause at least one condition is not satisfied 10100 badPortWidthErr The requested digital port width is not a multiple of the hardware port width 10120 gpctrBadApplicationError Invalid application us...

Страница 58: ...or the device is empty or invalid The configuration specified does not agree with the current configuration of the device The EISA system configuration is invalid 10248 dupAddressErr The base addresse...

Страница 59: ...aChannel1Error Bad DMA channel 1 specified in the configuration utility or by the operating system 10259 dmaChannel2Error Bad DMA channel 2 specified in the configuration utility or by the operating s...

Страница 60: ...efore the device was supported 10402 deviceNotFoundErr No device is located in the specified slot or at the specified address 10403 DSPdeviceSupportErr The specified device does not support the reques...

Страница 61: ...ith the host Reset the chassis again to resynchronize it with the host 10345 chassisMemAllocError The required amount of memory cannot be allocated on the Remote SCXI unit for the specified operation...

Страница 62: ...ror can occur if the driver is unable to align the buffer because the buffer is too small 10444 DSPmemFullErr Possible reasons for this error are as follows No more system memory is available on the h...

Страница 63: ...ice user manual to determine group ramifications with respect to DMA 10458 diskFullError The storage disk you specified is full 10459 DSPDLLInterfaceErr The DLL could not be called because of an inter...

Страница 64: ...armed 10607 armedErr The specified resource is already armed 10608 noTransferInProgErr No transfer is in progress for the specified resource 10609 transferInProgErr A transfer is already in progress...

Страница 65: ...assigned 10623 postTrigErr No posttrigger source has been assigned 10624 delayTrigErr The delayed trigger mode is not supported or is not available in the current configuration or no delay source has...

Страница 66: ...tinuous double buffered operation with a synchronous function call 10637 bufferAlreadyConfigError Attempted to configure a buffer after the buffer had already been configured You can configure a buffe...

Страница 67: ...You cannot use an external scan clock when performing a single scan of a single channel 10694 unsafeSamplingFreqErr The sample frequency exceeds the safe maximum rate for the hardware gains and filte...

Страница 68: ...nputModeErr When you have an SC2040 attached to your device all analog input channels must be configured for differential input mode 10781 outputTypeMustBeVoltageEr ror The polarity of the output chan...

Страница 69: ...Attempted to start a pulse width measurement with the pulse in the phase to be measured e g high phase for high level gating 10810 internalDriverError An unexpected error occurred inside the driver w...

Страница 70: ...ot available at the time of the DMA chaining interrupt DMA transfers will terminate at the end of the currently active transfer buffer 10848 noDMACountAvailErr The driver could not obtain a valid read...

Страница 71: ...ransferred to the waveform buffer of the Remote SCXI unit to keep up with the waveform update rate Try using a slower waveform update rate if possible 10884 pretrigReorderError Could not rearrange dat...

Страница 72: ...n B 19 Measure Data Acquisition User Manual 2101 iERR_AO_MULTIPLE_CHANS_ PER_STRING An analog output channel string represents multiple analog output channels Measure requires that each analog output...

Страница 73: ...you find it select it and click on the OK button If a dialog box appears with the message Replace existing DAQ XLA click on the Yes button You will see a Measure Data Acquisition Add In entry in the l...

Страница 74: ...ontact National Instruments for an updated version of the NI DAQ driver Problem You get a dialog box entitled Measure with a message that begins Fatal error Solution Congratulations It is likely that...

Страница 75: ...s has BBS and FTP sites dedicated for 24 hour support with a collection of files and documents to answer most common customer questions From these sites you can also download the latest instrument dri...

Страница 76: ...country If there is no National Instruments office in your country contact the source from which you purchased your software to obtain support Telephone Fax Australia 03 9 879 9422 03 9 879 9179 Aust...

Страница 77: ...itional pages if necessary Name Company Address Fax Phone Computer brand Model Processor Operating system Windows 3 1 Windows for Workgroups 3 11 Windows NT 3 1 Windows NT 3 5 Windows 95 other include...

Страница 78: ......

Страница 79: ..._________________________________________________ Microprocessor _________________________________________________________________ Clock Frequency _____________________________________________________...

Страница 80: ......

Страница 81: ..._______________________________________________________ Stop bits_______________________________________________________________________ Data bits______________________________________________________...

Страница 82: ......

Страница 83: ...e completeness clarity and organization of the manual If you find errors in the manual please record the page numbers and describe the errors Thank you for your help Name Title Company Address Phone M...

Страница 84: ......

Страница 85: ...ls 1D One dimensional 2D Two dimensional A A D Analog to digital ADC Analog to digital converter An electronic device often an integrated circuit that converts an analog voltage to a digital number AD...

Страница 86: ...all data is collected transferred into system memory and analyzed for the trigger condition When analog triggering is implemented in hardware no data is transferred to system memory until the trigger...

Страница 87: ...g to digital converters ADCs for analog input digital to analog converters DACs for analog output digital input or output ports and counter timers are conversion devices coupling The manner in which a...

Страница 88: ...ers an event such as A D conversion F FIFO A first in first out memory buffer In a FIFO the first data stored is the first data sent to the acceptor G gain The factor by which a signal is amplified so...

Страница 89: ...ir gains to determine the input limits interrupt A signal indicating that the central processing unit should suspend its current task to service a designated activity I O Input output The transfer of...

Страница 90: ...includes the data leading up to the trigger condition R Range A group of rows and columns on a spreadsheet RMS Root mean square RSE Referenced single ended S scan One reading from each channel or por...

Страница 91: ...s are transferred per second Synchronization occurs before and after the transmission of blocks of data rather than before and after every character There are no start bits or stop bits as there are i...

Страница 92: ...er Manual G 8 National Instruments Corporation V V volts Visual Basic for The programming language built into Microsoft Applications VBA Excel Vref Voltage reference W waveform Multiple voltage readin...

Страница 93: ...eries and portable devices table A 5 MIO and AI devices table A 2 to A 3 SCXI modules table A 6 analog input configuration See also Analog Input Configuration dialog box advanced timing settings 4 10...

Страница 94: ...ell field Analog Input Configuration dialog box 4 6 B boards See DAQ devices bulletin board support D 1 C channel clock and scan clock figure 4 5 Channel field Analog Output Configuration dialog box 2...

Страница 95: ...mentation conventions used in manual x xi organization of manual ix x E Edit DAQ Menu dialog box 2 8 Edit Menu option DAQ Tasks dialog box 2 10 Edit option DAQ Tasks dialog box 2 10 e mail support D 2...

Страница 96: ...Input Mode dialog box 4 9 Number of iterations field Analog Output Configuration dialog box 2 6 5 2 Number of scans field Analog Input Configuration dialog box 2 4 4 4 O operating modes SCXI modules 3...

Страница 97: ...1 to 5 3 mode reference 4 8 to 4 9 timing settings 4 4 to 4 5 trigger reference 4 7 to 4 8 managing tasks in workbook 2 9 to 2 10 saving 2 8 to 2 9 selecting 2 1 to 2 3 technical support D 1 to D 2 te...

Страница 98: ...Index Measure Data Acquisition User Manual I 6 National Instruments Corporation W waveforms generating on more than one channel note 5 3 WDAQCONF utility 1 1 workbook managing tasks in 2 9 to 2 10...

Отзывы: