E-mail: support@natinst.com
FTP Site: ftp.natinst.com
Web Address: www.natinst.com
Bulletin Board Support
BBS United States: 512 794 5422
BBS United Kingdom : 01635 551422
BBS France: 01 48 65 15 59
Fax-on-Demand Support
512 418 1111
Telephone Support (USA)
Tel: 512 795 8248
Fax: 512 794 5678
International Offices
Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazi l 011 288 3336,
Canada (Ontario) 905 785 0085, Canada (Québec) 514 694 8521, Denmark45 76 26 00,
Finland 09 725 7 25 11, France 01 48 14 24 24, Germany 089 741 31 30, Hong Kong 2645 3186,
Israel 03 6120092, Italy 02 413091, Japan 03 5472 2970, Korea 02 596 7456, Mexico 5 520 2635,
Netherlands 0348 433466, Norway 32 84 84 00, Singapore 2265886, Spain 91 640 0085, Sweden 08 730 49 70,
Switzerland 056 200 51 51, Taiwan 02 377 1200, United Kingdom 01635 523545
National Instruments Corporate Headquarters
6504 Bridge Point Parkway Austin, Texas 78730-5039 USA Tel: 512 794 0100
Important Information
Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming
instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced
by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not
execute programming instructions if National Instruments receives notice of such defects during the warranty period.
National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Autho rization (RMA) number must be obtained from the factory a nd clearly marked on the ou ts ide of
the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs
of returning to the owner parts which are covered by warranty.
National Instruments believes that the informatio n in this manual is accurate. The docume nt has been ca refully review ed
for technical accurac y. In th e even t that te ch nical o r typograp hic al errors exis t, Nation al Inst ruments rese rves th e right to
make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should
consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages
arising out of or related to this document or the information contained in it.
E
XCEPT AS SPECIFIED HEREIN
SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE
LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER
DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES
EVEN IF ADVISED OF THE POSSIBILITY THEREOF
regardless of the form of action, wheth er in contrac t or tort, inc luding neglig ence. Any ac tion against N ational Inst ruments
must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay
in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages,
defects, malfunctions, or service failures caused by owner’s failure to follow the National Instruments installation,
operation, or maintenance instructions; owner’s modification of the product; owner’s abuse, misuse, or negligent acts;
and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.
, N
ATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND
. This limitation of the liability of National Instruments will apply
. C
USTOMER’S
. N
ATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR
,
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical,
including photocopyi ng, recordi ng, st oring in an info rmation ret riev al syste m, or translating , in whole or in part, wit hout
the prior written consent of National Instruments Corporation.
Trademarks
CVI™, DAQArb™, DAQCard™, DAQ Designer™, DAQPad™, DAQ-PnP™, DAQ-STC™, DAQWare™,
LabVIEW™, NI-DAQ™, NI-DSP™, NI-PGIA™, RTSI™, and SCXI™ are trademarks of National Instruments
Corporation.
Product and company names referenced in this document are trademarks or trade names of their respective companies.
WARNING REGARDING MEDICAL AND CLINICAL USE OF NATIONAL INSTRUMENTS PRODUCTS
National Instruments products are not designed with components and testing intended to ensure a level of reliability
suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving medical
or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the
user or application des igner. Any us e or ap plica tion of Na tiona l Instrum ents pr oducts for or inv olving m edi cal or clin ica l
treatment must be performed by properly trai ned and qualifi ed medic al pe rsonne l, and al l tra ditiona l medic al safegu ards,
equipment, and procedu res that are appropriate in the particula r situation to prevent serious injury or dea th should al ways
continue to be used when Natio nal Instrume nts products are being use d. National In struments prod ucts are N OT intended
to be a substitute for any form of establis hed process, procedure, or e quipment us ed to monit or or safeguard human heal th
and safety in medical or clinical treatment.
About This Manual
How to Use the NI-DAQ Manual Set..............................................................................xiii
Organization of This Manual................................................ ...... .....................................xiii
Conventions Used in This Manual...................................................................................xiv
MIO and AI Device Terminology.....................................................................xvii
About the National Instruments Documentation Set.......................................................xix
Related Documentation....................................................................................................xx
The NI-DAQ Functi on Refe re nce M anu al f or PC Co mpat i ble s is f or users
of the NI-DA Q s oftware for PC com patibles version 6.1 . NI-D A Q software
is a powerful application programming interface (API) between your data
acquisition (DAQ) application and the National Instruments DAQ boards
for ISA, PCI, PXI, XT, PC Card (PCMCIA), VXIbus, EISA, and USB bu s
computers.
How to Use the NI-DAQ Manual Set
You should begin by reading the NI-DAQ User Manual for PC
Compatibles. Chapter 1, Introduction to NI-DAQ, contains a f low chart that
illustrates the sequence of steps you sh ould take to learn about and get
started with NI-DAQ software.
When you are familiar with the material in the NI-DAQ User Manual for
PC Compatibles, you can use the NI-DAQ Function Refer ence M anual for
PC Compatibles, which contains detailed descriptions of the NI-DAQ
functions. You also can use the Windows help file
contains all of the function reference material. Other documentation
includes the DAQ Hardware Overview Guide (
Configuration Utility help file (
Wizard help file (
CHANWIZ.HLP).
NIDAQCFG.HLP
About
This
Manual
NIDAQPC.HLP, which
HWOG.PDF), the NI-DAQ
and the DAQ Channel
,
)
Organization of This Manual
The NI-DAQ Function Reference Manual for PC Compatibles is organized
as follows:
•Chapter 1, Using the NI-DAQ Functions, contains important
information about how to apply the function descriptions in this
manual to your programming language and environment.
•Chapter2, Function Reference, contains a detailed explanation o f each
NI-DAQ function. The functions are arranged alphabetically.
•AppendixA, Status Codes, lists the status codes returned by NI-DA Q,
including the name and description.
National Instruments CorporationxiiiNI-DAQ FRM for PC Compatibles
About This Manual
•AppendixB, Analog Input Channel, Gain Settings, and
Voltage Calculation, lists the valid channel and gain settings for DA Q
boards, describes how NI-DAQ calculates voltage, and describes the
measurement of offset and gain adjustment.
•AppendixC, NI-DAQ Function Support, contains tables that show
which DAQ hardware each NI-DAQ function call supports.
•AppendixD, Customer Communication, contains forms you can use to
request help from Nati onal Instruments o r to comment on our products
and manuals.
•The Glossary contains an alphabetical list and description of terms
used in this manual, including abbreviations, acronyms, metric
prefixes, mnemonics, and symbols.
•The Index contains an alphabetical list of key terms and topics in this
manual, including the page where you can find each one.
Conventions Used in This Manual
The following conventions are used in this manual.
This icon to the left of bold italicized text denotes a note, which alerts you
to important information.
!
1102/B/C modules Refers to the SCXI-1102, SCXI-1102B, and SCXI-1102C modules and
12-bit deviceThese MIO and AI d evice s are listed in T able 1.
16-bit deviceThese MIO and AI d evice s are listed in T able 1.
445X deviceRefers to the PCI-4 451 a nd PCI-44 52.
455X deviceRefers to the PCI-4 551 a nd PCI-45 52.
516 deviceRefers to the DAQCard-516 and PC-516.
611X deviceRefers to the PCI-6110E and PCI-6111E.
6602 deviceRefers to the PCI-6 602 a nd PXI- 6602 .
AI deviceThese analog input devices are listed in Table 1.
NI-DAQ FRM for PC Compatiblesxiv
This icon to the left of bold italicized text denotes a caution, which advises
you of precautions to take to avoid injury, data loss, or a system crash.
the VXI-SC-1102, VX I-S C-1 102B, an d V XI- SC-1 102C su bm odules .
Am9513-based de viceThese dev ice s a re the A T-MI O-16 , AT -MIO - 16F-5, A T-MI O -16X,
AT-MIO-16D, and AT-MIO-64F-5.
boldBold text denotes the names of menus, menu items, paramete rs, dialog
boxes, dialog box buttons or options, icons, windows, Windows 95 tabs
or pages, or LEDs.
bold italicBold italic text denotes a note, caution, or warning.
DAQArb 5411 deviceRefers to the AT-5411 and PCI-5411.
DAQCard-500/700Refers to the DAQCard-500 and DAQCard-700.
DAQMeter 4350 Refers to the PC-4350, DAQCard-4350, and DAQPad-4350.
DIO 6533Refers to the AT-DIO- 32HS, PCI-D IO-3 2HS, D AQCa rd-6 533, a nd
PXI-6533.
DIO-24Refers to the PC -D IO -24, P C- DIO -24 PnP, a nd DAQC ard -D IO- 24.
DIO-32FRefers to the AT-DIO-32F.
DIO-96Refers to the PC -D IO-9 6, PC -DI O -96 PnP, P CI -DIO -9 6,
DAQPad-6507, DA QP ad-6 508 , an d PXI -65 08.
DIO deviceRefers to any DIO-24, DIO-32, DIO-6533, or DIO-96.
DSA deviceRefers to the PC I-4451 , PCI- 445 2, PCI -45 51, a nd PCI-45 52.
E Series deviceThese are MIO and AI devices. Refer to Table 1 for a complete list of
these devices.
italicItalic text denotes emphasis, a cross reference, or an introduction to
a key concept. This font a lso denotes text fo r which you supply the
appropriate word or value, such as in NI-DAQ 5.x.
Lab and 1200 analogRefers to the DAQCard-1200, DAQPad-1 200, La b-PC+, Lab-PC-1200,
output devicePCI-1200, and SCXI-1200.
Lab and 1200 deviceRefers to the DAQCard-1200, DAQPad-1200, Lab-PC+, Lab-PC-1200,
Lab-PC-1200AI, PCI-1200, a nd SCXI-1200 .
LPM deviceRefers to the PC-L P M-16 an d PC -LP M-16P n P.
MIO deviceRefe rs to multifunction I/O devices. See Table 1 for a list of these
National Instruments CorporationxvNI-DAQ FRM for PC Compatibles
About This Manual
MIO-F-5/16X d ev iceRefers to the A T-M IO - 16F- 5, AT- MI O-16 X, a nd the AT -M IO -64F -5 .
MIO-16/16D d ev iceRefers to the A T -MIO - 16 an d AT -M IO- 16D .
MIO-16XE-50 d evi ceRefers to the A T-M IO -16X E -50, DA QP ad-M IO- 16X E-50 , an d
NEC-MIO-16XE-5 0, a nd PCI- MIO -16 XE-5 0.
MIO-64Refers to the AT-MIO-64F-5, AT-MIO-64E-4, PCI-6031E, PCI-6033E,
PCI-6071E, VXI-MIO -64E-1, and VXI-M IO-64X E-10.
monospaceText in this font denotes text or characters that you should literally enter
from the keyboard, sections of co de, pro gramming ex ample s, and
syntax examples. This fo nt a lso is used for the pro per n am es of d isk
drives, paths, directories, programs, subprogram s, subroutines, device
names, functions, operations, variables, filenames, and extensions, and
for statements and c omm en ts take n from p rogra m code .
monospace italic
Italic text in this font denotes th at you mu st su pply the appr opriate
words or values in the place of these items.
NI-DAQRefers to the NI-DA Q softwa re for PC co mpat ible s, unless other wi se
noted.
PCRefers to the IBM PC/XT, IBM PC AT, and compatible computers.
PCI SeriesRefers to the National Instrum ents p rod ucts that use the
high-performance expan sion bus architec ture origin ally develope d
by Intel to replace ISA and EISA.
Remote SCXIRefers to an SCXI configuration where either an SCXI-2000 chassis or
an SCXI-2400 remote commu nications module is connected to the PC
serial port.
SCXI-1102/B/C SCXI-1102/B/C refers to the SCX I-11 02, SCX I-11 02B , an d
SCXI-1102C devices.
SCXI-1120/D SCXI-1120/D refers to the SCXI-112 0 and SCXI-11 20D.
SCXI analog i np ut Refers to t he S C XI -1 100, SC X I-1102 , S CXI-1 120 , S CXI-1 120 D,
moduleSCXI-1121, SCXI-1122, SCXI- 1140, and SCX I-1141 .
SCXI chassisRefers to the SCXI-1000, SCXI-1000DC, SCXI-1001, and SCXI-2000.
SCXI digital modul eRefers to the SCXI -1160 , SCXI-1 161, S CXI-1 162, SCX I-1162 HV,
Simultaneous samplingRefers to the PCI-6110E, PCI-6111E, PCI-4451, PCI-4452, PCI-4551,
deviceand PCI-4552.
VXI-MIO deviceRefers to the VXI-MIO-64E-1 and VXI-MIO-64XE-10.
VXI-SC-1102/B/CRefers to the VXI-SC-1102 , VXI-SC- 110 2B, a nd V XI-SC -11 02C.
MIO and AI Device Terminology
This manual uses generic terms to describe groups of devices whenever
possible. The generic terms for the MIO and AI devices are based on
the number of bits, the platform, the functionality, and the series name
of the devices. Table 1 lists each MIO and AI device and the possible
classifications for each.
Table 1.
Number
of SE
Device
AT-AI-16XE-101616-bitATAIE Series
AT-MIO-161612-bitATMIOAm9513-based
AT-MIO-16D1612-bitATMIOAm9513-based
AT-MIO-16DE-101612-bitATMIOE Series
AT-MIO-16E-11612-bitATMIOE Series
AT-MIO-16E-21612-bitATMIOE Series
AT-MIO-16E-101612-bitATMIOE Series
AT-MIO-16F-51612-bitATMIOAm9513-based
AT-MIO-16X1616-bitATMIOAm9513-based
AT-MIO-16XE-101616-bitATMIOE Series
AT-MIO-16XE-501616-bitATMIOE Series
AT-MIO-64E-36412-bitATMIOE Series
AT-MIO-64F-56412-bitATMIOAm9513-based
DAQCard-AI-16E-41612-bitPCMCIAAIE Series
Channels
MIO and AI Devices
BitTypeFunctionalitySeries
DAQCard-AI-16XE-501616-bitPCMCIAAIE Series
DAQPad-MIO-16XE-501616-bitParallel PortMIOE Series
DAQPad-6020E1612-bitUSBMIOE Series
NEC-AI-16E-41612-bitNECAIE Series
National Instruments CorporationxviiNI-DAQ FRM for PC Compatibles
About This Manual
Table 1. MIO and AI Devices (Continued)
Number
Device
NEC-AI-16XE-501616-bitNECAIE Series
NEC-MIO-16E-41612-bitNECMIOE Series
NEC-MIO-16XE-501616-bitNECMIOE Series
PCI-6031E (MIO-64XE-1 0)6416-bitPCIMIOE Series
PCI-6032E (AI-16XE-10)1616-bitPCIAIE Series
PCI-6033E (AI-64XE-10)6416-bitPCIAIE Series
PCI-6071E (MIO-64E-1)6412-bitPCIMIOE Series
of SE
Channels
BitTypeFunctionalitySeries
PCI-6110E4 diff.
only
PCI-6111E2 diff.
only
PCI-MIO-16E-11612-bitPCIMIOE Series
PCI-MIO-16E-41612-bitPCIMIOE Series
PCI-MIO-16XE-101616-bitPCIMIOE Series
PCI-MIO-16XE-501616-bitPCIMIOE Series
PXI-6011E1616-bitPXIMIOE Series
PXI-6030E1616-bitPXIMIOE Series
PXI-6040E1612-bitPXIMIOE Series
PXI-6070E1612-bitPXIMIOE Series
VXI-MIO-64E-16412-bitVXIMIOE Series
VXI-MIO-64XE-106416-bitVXIMIOE Series
The NI-DAQ Function Reference Manual for PC Compatibles is one piece
of the documentation set for your DAQ system. You might have any of
several types of manuals, depending on the hardware and software in your
system. Use these manuals as follows:
•Your SCXI hardware user manuals—If y ou are using SCXI, read these
manuals next for detailed information about signal connections and
module configuration. They also explain in greater detail how the
module works and contain application hints.
•Your DAQ hardware user manuals—These manuals have detailed
information about the DAQ hardware that plugs into or is connected
to your computer. Use these manuals for hardware installation and
configuratio n i ns truct i on s, speci fication informati o n abo ut you r DAQ
hardware, and application hint s .
•Software documentation—Examples of software documentation you
might have are the ComponentWorks, LabVIEW and
LabWindows/CVI, VirtualBench, and NI-DAQ documentation. After
you have set up your hardware system, use either the application
software or the NI-D AQ do cuments to help you write your application.
If you have a large and complicated system, it is worthwhile to look
through the software manuals before you configure your hardware.
•Accessory installation guides or manuals—If you are using accessory
products, read the terminal block and cable assembly installation
guides or accessory board user manuals. They explain how to
physically connect the relevant pieces of the system. Consult these
guides when you are making your connections.
•SCXI Ch assis User Ma nual—If you are us ing SCXI, read this manual
for maintenance information on the chassis an d installation
instructions.
National Instruments wants to receive your comments on our products
and manuals. We are interested in the applications you develop with
our products, and we want to help if you have problems with them.
To make it easy for you to contact us, this manual contains comment
and configuration forms for you to complete. These forms are in
Appendix D, Custome r Communication, at the end of this manual.
This chapter contains important information about how to apply the
function descriptions in this manual to your programming language and
environment.
When you are familiar with the material in the NI-DAQ User Manual for PC Compatibles, you can use this manual for detailed information about
each NI-DAQ function.
1
Status Codes, Device Numbers, and SCXI Chassis IDs
National Instruments Corporation1-1NI-DAQ FRM for PC Compatibles
In all applications,
contains a list of
In the parameter tables that follow the status codes, the first parameter to
almost ev ery NI-DA Q functi on is the device n umber of the D AQ d evice you
want NI-DAQ to use for the given operation. After you have followed the
installation and configuration instructions in the NI-D A Q release notes and
Chapter 1, Introduction to NI-DAQ, of the NI-DAQ User Manual for PC Compatibles, you can use the NI-DAQ Configuration Utility to determine
the device number for each de vice you ha ve installed in the system.You can
status
status
is always a 16-bit integer. Appendix A,
codes.
Status Codes
,
Chapter 1Using the NI-DAQ Functions
use the configuration utility to verify your device numbers. You can use
multiple DAQ devices in one application; to do so, simply pass the
appropriate device number to each function.
If you are using SCXI, you must pass the chassis ID that you assigned to
your SCXI chassis in the configuration utility to the SCXI functions that
you use. For many of the SCXI functions, you must also pass the module
slot number of the module you want to use. The slots in the SCXI chassis
are numbered from left to rig ht, beginning wi th slot 1. The controlle r on the
left side of the chassis is referred to as Slot 0. Y ou can use the configuration
utility to verify your chassis IDs and your module slot numbers.
Variable Data Types
The NI-DAQ API is identical in Windows 95 and Windows NT. Every
function description has a parameter table that lists the data types in each
of the environments. LabWindows/CVI uses the same types as Windows.
The following sections describe the notation used in those parameter tables
and throughout the manual for variable data types.
Primary Types
Table 1 -2 shows the primary type names and their ranges.
Type
Name
u88-bit ASCII
i1616-bit signed
DescriptionRange
0 to 255
character
–32,768 to 32,767
integer
Table 1-2.
Primary Type Names
C/C++Visual BA SIC
char
shortInteger
Not supported by
BASIC. For functions
that require ch arac ter
arrays, use string
types instead. See the
STR description.
Use character
array terminat ed
by the null
character
\0
Not supported by
BASIC. For functions
that require unsigned
integers, use the
signed integer type
instead. See the i16
description.
(for example:
count&
Not supported by
BASIC. For functions
that require unsigned
long integers, us e the
signed long integer
type instead. See th e
i32 description.
example:
example:
voltage#
String
example:
filename$
Type
)
(for
num!
(for
(for
Pascal (Borland
Delphi)
Word
LongInt
Cardinal
32-bit operating
systems). Refer to
the i32
description.
Single
)
Double
)
String
)
(in
Arrays
When a primary type is inside square brackets (for example, [i16]) an array
of the type named is required for that parameter.
Multiple Types
Some parameters can be in multiple types. Combinations of the primary
types separated by commas denote parameters with th is ability, as in the
following example:
National Instruments Corporation1-3NI-DAQ FRM for PC Compatibles
Chapter 1Using the NI-DAQ Functions
The previous example describes a parameter that can accept an array of
signed integers or an array of floating-point numbers.
Programming Language Considerations
Apart from the data type differences, there are a few language-dependent
considerations you need to be aware of when you use the NI-DAQ API.
Read the following sections that apply to your programming language.
Note
Be sure to include the NI-DAQ function prototype files by including the
appropriate NI-DAQ header file in your source code.
Borland Delphi
When you pass arrays to NI-DAQ functions using Borland Delphi in
Windows, you need to pass a pointer to the array. You can either declare an
array and pass the array address to the NI-DAQ function, or you can
declare a pointer, dynamically allocate memory for the pointer, and pass
the pointer directly to the NI-DAQ function. For example,
var
buffer : array [1..1000] of Integer;
bufPtr : ^Integer;
status := DAQ_Start (device, chan, gain, @buffer, count,
timebase, sampInterval);
or
(* allocate memory for bufPtr first using AllocMem or
New *)
status := DAQ_Start (device, chan, gain, bufPtr, count,
timebase, sampInterval);
Visual Basic for Windows
When you pass arrays to NI-DAQ functions using Visual Basic for
Windows, you need to pass the first element of the array by referen ce. For
example, you would call the
syntax:
The file NIDAQCNS.INC contains definitions for constants required for
some of the NI-DAQ functions. You should use the constants symbols in
your programs; do not use the numerical values.
In Visual Basic for Windows, you can add the entire
NIDAQCNS.INC file
into your project. You then will be able to use any of the constan ts def i ned
in this file in any module in your program.
T o add the
NIDAQCNS.INC file for your pr oject in V isual Ba sic 3.0 and 4.0,
go to the File menu and select the Add File... option. Select
NIDAQCNS.INC, which is the Include subdirectory of NI-DAQ
subdirectory. Then, select Open to add the file to the project.
To add the
NIDAQCNS.INC file to your project in Visual Basic 5.0, go to
the Project menu and select Add Module. Click on the Existing tab page.
NIDAQCNS.INC, which is the Include subdirectory of your
Select
NI-DAQ directory. Then, select Open to add the file to the project.
This procedure is identical to the procedure you would follow wh en loading
the Visual Basic f ile
CONSTANT.TXT. Search on the word CONSTANT for
more information from the V isual Basic on-line help. Alternatively , you can
cut and paste individual lines from this file and place them in the module
where you need them. Ho wever , if you do so, yo u shoul d remo v e the w or d
Global from the CONSTANTS definition.
For example,
GLOBAL CONST ND_DATA_XFER_MODE_AI& = 14000
would become:
CONST ND_DATA_XFER_MODE_AI& = 14000
NI-DAQ for LabWindows/CVI
Inside the LabWindows/CVI environment, the NI-DAQ functions appear
in the Data Acquisition function panels under the Libraries menu. Each
function panel represents an NI-DAQ function, which is displayed at the
bottom of the panel. The function panels have help text for each function
and each parameter; however, if you n eed ad ditional inf ormatio n, y ou can
look up the appropriate NI-DAQ function alphabetically in Chapter 2,
National Instruments Corporation1-5NI-DAQ FRM for PC Compatibles
Chapter 1Using the NI-DAQ Functions
Table 1-3 shows how the LabWindows/CVI function panel tree is
organized, and the NI-DAQ function name that corresponds to each
function panel.
Table 1-3.
LabWindows/CVI Function PanelNI-DAQ Function
Data Acquisition
Initialization/Utilities
Initialize Board
Configure Timeout
Get Device Information
Set Device Information
Align DMA Buffer
Get DAQ Library Version
Select E-Series Signals
Config Analog Trigger
Change Line Attribute
Board Config & Calibrate
Configure MIO Boards
Configure AMUX Boards
The LabWindows/CVI Function Tree for Data Acquisition
Init_DA_Brds
Timeout_Config
Get_DAQ_Device_Info
Set_DAQ_Device_Info
Align_DMA_Buffer
Get_NI_DAQ_Version
Select_Signal
Configure_HW_Analog_Trigger
Line_Change_Attribute
MIO_Config
AI_Mux_Config
Configure SC-2040
Calibrate MIO Boards
Calibrate E Series
Calibrate LPM-16
Calibrate Analog Output
Calibrate 1200 Devices
Calibrate DSA Devices
Change Analog Input Parameter
Measure Voltage
Clear Analog Input
Read Analog Binary
Scale Binary to Voltage
Setup Analog Input
Check Analog Input
Configure Analog Input
Multiple Point
Acquire Single Channel
Scan Multiple Channels
Scan Lab Channels
Table 1-3.
The LabWindows/CVI Function Tree for Data Acquisition (Continued)
AI_Change_Parameter
AI_VRead
AI_Clear
AI_Read
AI_VScale
AI_Setup
AI_Check
AI_Configure
DAQ_Op
SCAN_Op
Lab_ISCAN_Op
Single Scan Binary
Single Scan Voltage
Single Channel to Disk
Multiple Chan to Disk
Scan Lab Chan to Disk
The LabWindows/CVI Function Tree for Data Acquisition (Continued)
LabWindows/CVI Function PanelNI-DAQ Function
Waveform Generation
Generate WFM from Array
Generate WFM from Disk
WFM_Op
WFM_from_Disk
Low-Level Functions
Scale Waveform Buffer
Convert Waveform Rate
Assign Waveform Group
Load Waveform Buffer
Assign Rate to WFM Group
Control Waveform Group
Pause/Resume WF M Cha nnel
Check Waveform Channel
Enable Double Buffering
Is Half Buffer Read y?
WFM_Scale
WFM_Rate
WFM_Group_Setup
WFM_Load
WFM_ClockRate, WFM_Set_Clock
WFM_Group_Control
WFM_Chan_Control
WFM_Check
WFM_DB_Config
WFM_DB_HalfReady
Copy Array to WFM Buffer
WFM_DB_Transfer
Digital Input/Output
Configure Port
Configure Line
Read Port
Read Line
Write Port
Write Line
Get Port Status
Configure Trigger
National Instruments Corporation1-9NI-DAQ FRM for PC Compatibles
DIG_Prt_Config
DIG_Line_Config
DIG_In_Port
DIG_In_Line
DIG_Out_Port
DIG_Out_Line
DIG_Prt_Status
DIG_Trigger_Config
Chapter 1Using the NI-DAQ Functions
Table 1-3.
The LabWindows/CVI Function Tree for Data Acquisition (Continued)
LabWindows/CVI Function PanelNI-DAQ Function
Group Mode
Configure Group
Read Group
Write Group
Get Group Status
Set Group Mode
DIG_Grp_Config
DIG_In_Grp
DIG_Out_Grp
DIG_Grp_Status
DIG_Grp_Mode
Block Transfer
Read Block
Write Block
Check Block
Clear Block
Set Up Pattern Generation
Set Up Digital Scanning
Enable Double Buffering
DIG_Block_In
DIG_Block_Out
DIG_Block_Check
DIG_Block_Clear
DIG_Block_PG_Config
DIG_SCAN_Setup
DIG_DB_Config
Is Half Buffer Read y?
Transfer To/From Array
SCXI
Load SCXI Configuration
Change Configuration
Get Chassis Config Info
Get Module Config Info
Read Module ID Register
Reset SCXI
Set Up Single AI Channel
Set Up Muxed Scanning
The LabWindows/CVI Function Tree for Data Acquisition (Continued)
LabWindows/CVI Function PanelNI-DAQ Function
Set Up Mux Counter
Set Up Track/Hold
Control Track/Hold State
Select Gain
Configure Filter
Select Scanning Mode
Change AI Channel
Scale SCXI Data
Write to AO Channel
Set Digital or Relay State
Get Digital or Relay State
Get Status Register
Set Up Calibration Mode
Change Cal Constants
National Instruments Corporation1-11NI-DAQ FRM for PC Compatibles
CTR_Config
CTR_EvCount
Chapter 1Using the NI-DAQ Functions
Table 1-3.
The LabWindows/CVI Function Tree for Data Acquisition (Continued)
LabWindows/CVI Function PanelNI-DAQ Function
Count Periods
Read Counter
Stop Counter
Restart Counter
Reset Counter
Get Counter Output State
Convert CTR Rate
Generate Pulse
Generate Square Wave
Generate Freq OUT Signal
Operate Multi Counters
Initialization/Utilities is a class of functions used for general board
initialization and configuration, for configuration retrieval, and for setting
NI-DA Q properties. This class also contains several useful utility functions.
Board Config & Calibrate is a class of functions that perform calibration
and configuration that is specific to a single type of board.
The Analog Input class contains all of the classes of functions that perform
A/D conversions.
Single Point is a class of Analog Input functions that perform A/D
conversions of a single sample.
Multiple Point is a class of functions that perform clocked, buffered
multiple A/D conversions typically used to capture waveforms. This class
includes high-level functions and a Low-Level Functions subclass. The
high-level functions are synchronous; that is, your application is blocked
while these functions are performing the requested number of A/D
conversions. The low-level functions are asynchronous; that is, your
application continues to run while the board performs A/D conversions in
the background. The low-level functions al so in cl ude th e doubl e- buffered
functions.
The Analog Output class contains all the classes of functions that perform
D/A conversions.
Single Point is a class of Analog Output functions that perfo rm single D/A
conversions.
Waveform Generation is a class of functions that perform buffered analog
output. The W avefo rm Generation functions generate wav eforms from data
contained in an array or a disk file. The Low-Level Functions subclass
provides a finer level of control in generating multiple D/A conversions.
Digital Input/Output is a class of functions that perform digital input and
output operations. It also contains two subclasses. Group Mode is a
subclass of the Digital Input/Output class that contains functions for
handshaked digital input and output operations. Block Transfer is a
subclass of the Group Mode class that contains functions for handshaked or
clocked, buffered or double-buffered digital input and output operations.
SCXI is a class of functions used to configure the SCXI line of signal
conditioning products.
National Instruments Corporation1-13NI-DAQ FRM for PC Compatibles
Chapter 1Using the NI-DAQ Functions
Counter/Timer is a class of function panels that perform counting and
timing operations. DAQ-STC Counters (GPCTR) is a subclass of
Counter/Timer that contains functions that perform operations on the
DAQ-STC counters on the E Series devices. Am9513 Counters (CTR) is
another subclass of Counter/Timer that contains functions that perform
operations on the Am9513 counters on t he Am9513-bas ed devi ces, and the
PC-TIO-10. 8253 Counters (ICTR) is a subclass of Counter/Timer that
contains functions that perform counting and timing operations for the
DAQCard-500/700 and 516, Lab and 1200 series, and LPM devices.
RTSI Bus is a class of function panels that connect control signals to the
RTSI bus and to other boards.
The DAQ Event Messages class contains functions that set up conditions
for sending messages to your application when certain events occur.
This chapter contains a detailed explanation of each NI-DAQ function. The functions are
arranged alphabetically.
AI_Change_Parameter
Format
status = AI_Change_Parameter (deviceNumber, channel, paramID, paramValue )
Purpose
Selects a specific parameter for the analog input section of the device or an analog input
channel. You can select parameters related to analog input not listed here through the
AI_Configure function.
Input
NameTypeDescription
deviceNumber
i16assigned by configuration utility
2
channel
paramID
paramVal ue
i16number of channel you want to config ure; use –1
to indicate all channels
u32identification of the parameter you want to change
u32new value for the parameter specified by
paramID
Parameter Discussion
Legal ranges for
header file. The header file you should use depends on the language you are using:
National Instruments Corporation2-1NI-DAQ FRM for PC Compatibles
Visual Basic for Windows programmers should refer to the Visual Basic f or
Windows topic for more information.
paramID
NIDAQCNS.H (DATAACQ.H for LabWindows/CVI)
paramValue
and
NIDAQCNS.INC
are given in terms of constants defined in a
Chapter 2Function Reference — AI_Change_Parameter
•Pascal programmers—NIDAQCNS.PAS
Legal values for channel depend on the type of device you are using; analog input channels
are labeled 0 through n – 1, where n is the number of analog input channels on your device.
You can set channel to –1 to indicate that you want the same parameter selection for all
channels.
NoteFor the 611X devices, specify
the PFI_0 line for the analog trigger.
Legal values for paramValue depend on par am ID . The following paragraph list features
you can configure al ong with le gal v alues for paramID with explanat ions and corresp onding
legal values for paramValue.
Channel Coupling
Some analog input devices have programmable AC/DC coupling for the analog input
channels. To change the coupling parameter, set paramID to
Coupling Parameters
Device Type
PCI-6110EYesND_AC and ND_DC
PCI-6111EYesND_AC and ND_DC
PCI-445XYesND_AC and ND_DC
PCI-455XYesND_AC and
Using This Function
You can customize the behavior of the analog input section of your device by using this
function. Call this function before calling NI-DAQ functions that cause input on the analog
input channels. You can call this function as often as needed.
status = AI_Check (deviceNumber, readingAvailable, reading)
Purpose
Returns the status of the analog input circuitry and an analog input read ing if one is av ailable.
AI_Check is intended for use when A/D conversions are initiated by external pulses applied
at the EXTCONV* pin or, if you are using the E Series devices, at the pin selected through
Select_Signal function; see DAQ_Config for information on enabling external
the
conversions.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
Output
NameTypeDescription
readingAvailablei16whether a reading is available
readingi16integer result
Parameter Discussion
readingAvailable represents the status of the analog input circuitry.
1:NI-DAQ returns an A/D conversion result in reading.
0:No A/D conversion result is available.
reading is the integer in which NI-DAQ returns the 12-bit result of an A/D conversion. If the
device is configured for unipolar operation, reading ranges from 0 to 4,095. If the device is
configured for bipolar operation, reading ranges from –2,048 to +2,047. For devices with
16-bit ADCs, reading ranges from 0 to 65,535 i n unipol ar operatio n, and –32,76 8 to +32,767
in bipolar operation.
National Instruments Corporation2-3NI-DAQ FRM for PC Compatibles
C Programmers—r eadingAvailable and reading are pass-by-reference
parameters.
Chapter 2Function Reference — AI_Check
Using This Function
AI_Check checks the status of the analog inpu t circuitry. If the device has performed an A/D
conversion,
Otherwise,
AI_Setup, in conjunction with AI_Check and AI_Clear, is useful for externally timed A/D
conversions. Before you call
of any previous conversion results. The device then performs a conversion each time the
device receiv es a pulse at the appropriate p in. You can call
available conversion results.
AI_Check returns read ing Av ailabl e = 1 and the A/D conversion result.
AI_Check returns readingAvailable = 0.
AI_Setup, you can call AI_Clear to clear out the A/D FIFO
AI_Check to check for and return
Note
You cannot use this function if you have an SC-2040 connected to your DAQ
device.
Clears the analog input circuitry and empties the FIFO memory.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
Using This Function
AI_Clear clears the analog input circuitry and empties the analog input FIFO memory.
AI_Clear also clears any analog input error conditions. Call AI_Clear before AI_Setup to
clear out the A/D FIFO memory before any series of externally triggered con ver sions be gins.
National Instruments Corporation2-5NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_Configure
AI_Configure
Format
status = AI_Configure (deviceNumber, chan, inputMode, inputRange, polarity, driveAIS)
Purpose
Informs NI-DAQ of the input mode (single-ended or differential), input range, and input
polarity selected for the device. Use this function if you have changed the jumpers affecting
the analog input configuration from their factory settings. For devices that have no jumpers
for analog input configuration, this function programs the device for the settings you want.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16channel to be configured
inputModei16indicates whether channels are configured for
single-ended or differential operation
inputRangei16voltage range of the analog input channels
polarityi16indicates whether the ADC is configured for
driveAISi16indicates whether to drive AISENSE to onboard
Parameter Discussion
chan is the analog input channel to be configured. Except for the E Series devices,
the AT-MIO-64F-5, and the A T-MI O-16X, you must se t chan to –1 because the same analog
input configuration applies to all of the channels. For the E Series devices, AT-MIO-64F-5,
and A T-M IO-16X, chan specifies the channel to be con figured. If you want all of the channels
to be configured identically, set chan to –1.
Range:See Table B-1 in Appendix B, Analog Input Channel, Gain Settings, and
Voltage Calculation.
inputMode indicates whether the analog input channels are configured for single-ended or
differential operation:
1:Referenced Single-Ended (RSE) configuration (used when the input signal does
not have its own ground reference. The negative input of the instrumentation
amplifier is tied to the instrumentation amplifier signal ground to provide one).
2:Nonreferenced Single-Ended (NRSE) configuration (used when the input signal
has its own ground reference. The ground reference for the input signal is
connected to AISENSE, which is tied to the negative input of the instrumentation
amplifier).
inputRange is the voltage range of the analog input channels. polarity indicates whether the
ADC is configured for unipolar or bipolar operation:
T able 2-1 shows all possible settings for inputMode, inputRange, a nd pola rity. inputMode
is independent of inputRange and polarity. In this table, italic text denotes default settings.
National Instruments Corporation2-7NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_Configure
Table 2-1.
Parameter Settings for
AI_Configure
(Continued)
Analog Input Range
Resulting
Device
LPM Devices
(RSE
inputMode
only)
Possible
Values for
inputMode
inputRangepolarity
ignored5unipolar0 to +5 VNo
5bipolar–2.5 to +2.5
Analog
Input
Range
V
10unipolar0 to +10 V
10bipolar–5 to +5 V
516 Devices,
110bipolar–5 to 5 VN/A
DAQCard-500
DAQCard-7000, 15bipolar–2.5 to +2.5
V
10bipolar–5 to +5 V
20bipolar–10 to +10 V
Software
Configurable
(PC-LPM-16)
Yes
(PC-LPM-16PnP)
Yes
NoteIf a device is software configurable, the inputMode, inputRange, and polarity
parameters are used to program the device for the configuration you want. If a
device is not software configurable, this function uses these parameters to inform
NI-DA Q of the device configuration, which you must set using hardware jumpers.
If your device is software configurable and you have changed the analog input
settings through the NI-DAQ Configuration Utility, you do not have to use
AI_Configure, although it is good practice to do so in case you inad vertently
change the configuration file maintained by the NI-DAQ Configuration Utility.
driveAIS, for the A T-MIO-64 F-5 and AT-MIO-16X, indicates whether to driv e AISENSE to
onboard ground or not. This parameter is ignored for all other devices.
0:Do not drive AISENSE to ground.
1:Drive AISENSE to ground.
Notice that if you have configured any of the input channels in nonreferenced single-ended
(NRSE) mode, this function returns a warning, inputModeConflict (18), if you se t driveAIS
to 1. When NI-D A Q reads a ch annel in NRSE mode, the d evice uses AISENSE as an input to
the negative input of the amplifier, regardless of the driveAIS setting. When NI-DAQ reads
a channel in differen tial or referenced single-ended (RSE) mode, the de vice dri v es AISENSE
to onboard ground if driveAIS is 1.
When you attach an SC-2040 or SC-2042-RTD to your DAQ device, you must configure
channels 0 through 7 for differential mode. When you attach an SC-2043-SG or any SCC
accessories to your DAQ device, you must configure these channels for nonreferenced
single-ended mode. On the AT-MIO-16X, 16-bit E Series, AT-MIO-16F-5, and
AT-MIO-64F-5 devices, the calibration constants used for analog input change depending
on the polarity of the analog input channels. NI-DAQ always ensures that the calibration
constants in use match the current polarity of the channels.
Chapter 2Function Reference — AI_Configure
See the
Calibrate_E_Series function description for information about calibration
constant loading on the E Series devices.
If you change the polarity on AT-MIO-16X, AT-MIO-64F, and AT-MIO-16F-5 by calling
AI_Configure, NI-DAQ uses the following guidelin e s to en sure that appropriate co ns tan t s
are loaded automatically:
•AT-MIO-16X—NI-DA Q checks if the load area con tains the appropriate constants. If so,
NI-DAQ will load the constants from the load area. Otherwise, NI-DAQ will load the
constants from the factory area for the current polarity and return status code
calConstPolarityConflictError.
•AT-MIO-64F-5—This device has separate caldacs for unipolar and bipolar input.
Therefore, NI-DAQ does not need to reload calibration constants.
•AT-MIO-16F-5—The load area on this device contains constants for both unipolar and
bipolar input. Therefore, NI-DAQ will load the appropriate constants from the load area
for the current polarity.
Note
The actual loading of calibration constants will take place when you call an AI,
DAQ, or SCAN function. On the AT-MIO-16X, the need for reloading the constants
will depend on the polarity of the channel on which you are doing analog input.
Note
The PCI-6110E and PCI-6111E support differential bipolar operation only.
National Instruments Corporation2-9NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_Mux_Config
AI_Mux_Config
Format
status = AI_Mux_C onfig (deviceNumber, numMuxBrds)
Purpose
Configures the number of multiplexer (AMUX-64T) devices connected to the MIO and AI
devices and informs NI-DAQ of the presence of any AMUX-64T devices attached to the
system (MIO and AI devices only).
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
numMuxBrdsi16number of external multiplexer devices
Parameter Discussion
numMuxBrds is the number of external multiplexer devices connected.
0:No external AMUX-64T devices are connected (default).
1, 2, 4:Number of AMUX-64T devices connected.
Using This Function
You can use an external multiplexer device (AMUX-64T) to expand the number of analog
input signals that you can measure with the MIO and AI device. The AMUX-64T has 16
separate four-to-one analog multiplexer circuits. One AMUX-64T reads 64 single-ended
(32 differential) analog input signals. You can cascade four AMUX-64T devices to permit up
to 256 single-ended (128 dif ferential) analog input sign als to be read through one MIO or AI
device. Refer to Chapter 1, Introduction to NI-DAQ, of the NI-DAQ User Manual for PC
Compatibles. See Chapter 10, AMUX-64T External Multiplexer Device, in the DAQ
Hardware Overview Guide for more information on using the AMUX-64T.
AI_Mux_Config configures the number of multiplexer devices connected to the MIO or AI
device. Input channels are then referenced in subsequent analog input calls (
AI_Setup, and DAQ_Start, for example) with respect to the external AMUX-64T analog
input channels, instead of the MIO and AI device onboard channel numbers. You need to
execute the call to
NI-DAQ FRM for PC Compatibles2-10
AI_Mux_Config only once in an application program.
For the AT-MIO-64F-5, AT-MIO-64E-3, PCI-6031E (MIO-64XE-10), PCI-6033
(AI-64XE-10), and PCI-6071E (MIO-64E-1), you also must call
to use AMUX-64T channels. Refer to the
NoteSome of the digital lines of port 0 on the MIO or AI device with AMUX-64T
MIO_Config function for further details.
MIO_Config if you plan
devices are reserved for AMUX device control. Any attempt to change the port or
line direction or the digital values of the reserved line causes an error. Ta ble 2-2
shows the relationship between the number of AMUX-64T devices assigned to the
MIO or AI device and the number of digital I/O lines reserved. You can use the
remaining lines of port 0. On non-E Series devices, the remaining lines are
available for output only.
Table 2-2.
Port 0 Digital I/O Lines Reserved
Number of AMUX-64T Devices
Assigned to an MIO or AI Device
0none
1lines 0 and 1
2lines 0, 1, and 2
4lines 0, 1, 2, and 3
National Instruments Corporation2-11NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_Read
AI_Read
Format
status = AI_Read (deviceNumber, chan, gain, reading)
Purpose
Reads an analog input channel (initiates an A/D conversion on an analog input channel) and
returns the unscaled result.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog input channel number
gaini16gain setting for the channel
Output
NameTypeDescription
readingi16the integer result of the A/D conversion
Parameter Discussion
chan is the analog input channel number . If you are using SCXI, you must use the appropriate
analog input channel on the DAQ device that corresponds to th e SCXI channe l you want. To
select the SCXI channel, use
to Chapter 12, SCXI Hardware, in the DAQ Hardware Overview Guide and the NI-DAQ User Manual for PC Compatibles for more information on SCXI channel assignments.
Range:See Table B-1 in Appendix B, Analog Input Channel, Gain Settings, and
Voltage Calculation.
gain is the gain setting you use for the specified channel. This gain setting applies only to the
DAQ device; if you are using SCXI, establish any gain you want on the SCXI module either
by setting jumpers on the module or by calling
Analog Input Channel, Gain Settings, and Voltage Calculation, for valid gain settings. If you
use an inv alid gain, NI-DAQ returns an error . If you call
or 516 and LPM devices, NI-DAQ ignores the gain.
NI-DAQ FRM for PC Compatibles2-12
SCXI_Single_Chan_Setup before calling this function. Refer
National Instruments Corporation2-13NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_Read_Scan
AI_Read_Scan
Format
status = AI_Read_Scan (AI_Read_Scan (deviceNumber, reading)
Purpose
Returns readings for all analog input channels selected by SCAN_Setup (E Series devices
only, with or without the SC-2040 accessory).
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
Output
NameTypeDescription
reading[i16]readings from each sampled analog input channel
Parameter Discussion
reading is an array of readings from each sampled analog input channel. The length of the
reading array is equal to the number of channels selected in the
parameter. Range of elements in reading depends on your device A/D converter resolution
and the unipolar/bipolar selection you made make for a given channel.
Using This Function
AI_Read_Scan samples the analog input channels selected by SCAN_Setup, at half the
maximum rate permitted by your data acquisition hardware.
Selects an analog input channel and gain setting for externally pulsed conversion operations.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog input channel number
gaini16gain setting to be used
Parameter Discussion
chan is the analog input channel number . If you are using SCXI, you must use the appropriate
analog input channel on the DAQ device that corresponds to th e SCXI channe l you want. To
select the SCXI channel, use
to Chapter 12, SCXI Hardware, in the DAQ Hardwa re Overview Guide and the NI-DAQ User Manual for PC Compatibles for more information on SCXI channel assignments.
Range:See Table B-1 in Appendix B, Analog Input Channel, Gain Settings, and
Voltage Calculation.
SCXI_Single_Chan_Setup before calling this function. Refer
Chapter 2Function Reference — AI_Setup
gain is the gain setting to be used for the specified channel. gain applies only to the DAQ
device; if you are using SCXI, establish any gain you want on the SCXI module by settin g
jumpers on the module (if any) or by calling
Input Channel , Gai n Settings, and Voltage Calculation, for valid gain settings. If you use an
invalid gain, NI-D AQ returns an error. If you call
DAQCard-500/700, NI-DAQ ignores the gain.
National Instruments Corporation2-15NI-DAQ FRM for PC Compatibles
NI-DA Q does not distinguish between the low-gain and high-gain versions of the
AT- M IO-1 6. I f yo u en te r a ga in o f 10 and you have a device w ith ga i ns of 1 , 2, 4,
and 8, NI-DAQ uses a gain of 2 and returns no error.
SCXI_Set_Gain. Refer to Appendix B, Analog
AI_Setup for the 516 and LPM de vices or
Chapter 2Function Reference — AI_Setup
Using This Function
AI_Setup addresses the specified analog input channel and changes the input gain to the
specified gain setting.
externally timed A/D conversions. If your application calls
parameters different from those used in the last
again for
AI_Check to return data from the channel you want at the selected gain.
AI_Setup, in conjunction with AI_Check and AI_Clear, is used for
AI_Read with channel and gain
AI_Setup call, you must call AI_Setup
Note
This function cannot be used if you have an SC-2040 connected to your DAQ
device.
status = AI_VR ead (deviceNumber, chan, gain, voltage)
Purpose
Reads an analog input channel (initiates an A/D conversion on an analog input channel) and
returns the result scaled to a voltage in units of volts.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog input channel number
gaini16gain setting to be used for the specified channel
Chapter 2Function Reference — AI_VRead
Output
NameTypeDescription
voltagef64the measured voltage returned, scaled to units
Parameter Discussion
chan is the analog input channel number.
Range:See Table B-1 in Appendix B, Analog Input Channel, Gain Settings, and
Voltage Calculation.
gain is the gain setting to be used for the specified channel. Refer to Appendix B, Analog
Input Channel , GainSettings, and Voltag e Calculation, for valid gain settings. If you use an
invalid gain, NI-D AQ returns an error. If you call
DAQCard-500/700, NI-DAQ ignores the gain.
Note
NI-DA Q does not distinguish between the low-gain and high-gain versions of the
AT- M IO-1 6. I f yo u en te r a ga in o f 10 and you have a device w ith ga i ns of 1 , 2, 4,
and 8, NI-DAQ uses a gain of 2 and returns no error.
National Instruments Corporation2-17NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_VRead
voltage is the floating-point variable in which NI-DAQ returns the measured voltage, scaled
to units of volts.
NoteC Programmers—voltage is a pass-by-reference parameter.
Using This Function
AI_VRead addresses the specified analog input channel, changes the input gain to the
specified gain setting, and initiates an A/D conver sion.
complete and then scales and returns the result. I f the conversion does not complete within a
reasonable time, the call to
timeOutError code.
When you use SCXI as a front end for analog input to an MIO or AI device, Lab-PC+,
Lab-PC-1200, Lab-PC-1200AI, P CI-1200, LPM de vice, or D A QC ard-700, it is no t advisable
to use the
AI_VRead function because that function does not take into account the gain of the
SCXI module when scaling the data. Use the
call the
SCXI_Scale function.
When you have an SC-2040 accessory connected to an E Series device, this function takes
both the onboard gains and the gains on SC-2040 into account while scaling the data. When
you have an SC-2043 -SG accessory connected to your DAQ device, this function takes both
the onboard gains and the SC-2043-SG fixed gain of 10 into account while scaling the data.
AI_VRead is said to have timed out and NI-DAQ returns the
AI_Read function to get unscaled data, and then
AI_VRead waits for the conversion to
When you have any SCC accessories connected to an E Series device, this function takes both
the onboard gains and the SCC gains into account while scaling the data.
Returns readings in volts for all analog input channels selected by SCAN_Setup (E Series
devices only with or without the SC-2040 accessory).
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
Chapter 2Function Reference — AI_VRead_Scan
Output
NameTypeDescription
reading[f64]voltage readings from each sampled analog
Parameter Discussion
reading is an array of readings from each sampled analog input channel. The length of the
reading array is equal to the number of channels selected in the
parameter. NI-DAQ uses values you have specified in
parameter for computing voltages. If you have attached an SC-2040 or SC-2043-SG to your
DAQ device, NI-DAQ also uses values you have specified in
the sc2040gain parameter) or
voltages.
If you have SCC modules conn ected, NI-D AQ also uses the SCC module gain for computing
voltages.
Using This Function
AI_VRead_Scan samples the analog input channels selected by SCAN_Setup, at half
the maximum rate your D AQ hardware permits.Y ou mus t use the
to invoking this function.
You cannot use external signals to control A/D conversion timing and use this function at the
same time.
input channel
SCAN_Setup numChans
SCAN_Setup through the gains
SC_2040_Config (through
Set_DAQ_Device_Info (a fixed gain of 10) for computing
National Instruments Corporation2-19NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AI_VScale
AI_VScale
Format
status = AI_VScale (deviceNumber, chan, gain, g ainAdjust, offset, reading, voltage)
Purpose
Converts the binary result from an AI_Read call to the actual input voltage.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16chan nel on which bina ry reading was taken
gaini16gain setting used to take the reading
gainAdjustf64multiplying factor to adjust gain
offsetf64binary offset present in reading
readingi16result of the A/D conversion
Output
NameTypeDescription
voltagef64computed floating-point voltage
Parameter Discussion
chan is the onboard channel or AMUX channel on which NI-DAQ took the binary reading
AI_Read. For devices other than the AT-MIO-16X, AT-MIO-64F-5, and E Series
using
devices, this parameter is ignored because the scaling calculation is the same for all of the
channels. However, you are encouraged to pass the correct channel number.
gain is the gain setting that you used to take the analog input reading. If you us ed SCXI to
take the reading, this gain parameter should be the product of the gain on the SCXI module
channel and the gain that the D AQ device used. Refer to Appendix B, Analog Input C hannel,
Gain Settings, and Voltage Calculation, for valid gain settings. Use of invalid gain settings
causes NI-DAQ to return an error unless you are using SCXI. If you call
516 and LPM devices or DAQCard-500/700, NI-DAQ ignores the gain unless you are using
SCXI.
gainAdjust is the mult iplying factor to adjust the gain. Refer to Appendix B, Analog Input
Channel, Gain Settings, and Voltage Calculation, for the procedure for determining
gainAdjust. If you do not want to do any gain adjustment—for example, use the ideal gain
as specified by the gain parameter—set gainAdjust to 1.
offset is the binary offset that needs to be subtracted from the reading. Refer to Appendix B,
Analog Input Channel, Gain Settings, and Voltage Calculation, for the procedure for
determining offset. If you do not want to do any offset compensation, set offset to 0.
reading is the result of the A/D conversion returned by
voltage is the variable in which NI-DAQ returns the input voltage converted from reading.
NoteC Programmers—voltage is a pass-by-reference parameter.
Using This Function
Refer to Appendix B, Analog Input Channel, Gai n Settings, and Voltage Calculation, for the
formula
If your device polarity and range settings differ from the default settings shown in the
Init_DA_Brds function, be sure to call AI_Configure to inform the driver of the correct
National Instruments Corporation2-21NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Align_DMA_Buffer
Align_DMA_Buffer
Format
status = Align_DMA_Buffer (deviceNumber, resource, buffer, count, bufferSize, alignIndex)
Purpose
Aligns the data in a DMA buf fer to a void cr ossing a phy sical page boundary. This function is
for use with DMA waveform generation and digital I/O pattern gen eration (AT-MIO-16F- 5
and AT-DIO-32F only).
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
resourcei16represents the DAC channel or the digital input
or output group
buffer[i16] integer array of samples to be used
countu32number of data samples
bufferSizeu32actual size of buffer
Output
NameTypeDescription
alignIndexu32offset into the array of the first data sample
Parameter Discussion
resource represents the DAC channel (for waveform generation) or the digital input or output
group (for patter n generation) for which NI-DAQ uses the buffer.
0:DAC channel 0.
1:DAC channel 1.
2:DAC channels 0 and 1.
11:DIG group 1 (group size of 2).
12:DIG group 2 (group size of 2).
13:DIG group 1 (group size of 4).
buffer is the integer array of samples NI-DAQ uses in the waveform or pattern generation.
The actual size of buffer should be larger than the number of samples to make room for
possible alignment. If the actual size of the buffer is not big enough for alignment, the
function returns a memAlignmentError. For Windows applications running in real or
standard mode, a bufferSize of 2*count guarantees that there is enough room for alignment.
count is the number of data samples contained in buffer.
32
Range:3 through 2
– 1.
bufferSize is the actual size of buffer.
32
Range:count through 2
–1.
alignIndex is the variable in which NI-DAQ returns the offset into the array of the first
data sample. If NI-DAQ d id not have to align the buffer, NI-DAQ returns alignIndex as 0,
indicating that the data is still located at the beginning of the buffer. If NI-DAQ aligned the
buffer to av oi d a page boun dary, alignIndex is a value other than 0, and the first data sample
is located at buffer[ alignIndex] (if your array is zer o based ). I f you u se digi tal inpu t with an
aligned buffer, NI-DAQ stores the data in the buffer beginning at alignIndex.
NoteC Programmers—alignIndex is a pass-by-reference parameter.
Using This Function
Use Align_DMA_Buffer to avoi d the negative effects of page boundari es in the data buffer
on AT bus machines for the following cases:
•DMA waveform generation at close to maximum speed
•Digital I/O pattern generation at close to maximum speed
•Interleaved DMA waveform generation at any speed
•32-bit digital I/O pattern generation at any speed
The possibility of a page boundary occurring in the data buffer increases with the size of the
buffer. When a page boundary occurs in the data buffer, NI-DAQ must reprogram the DMA
controller before NI-DA Q can transfer the next data sample. The extra time needed to do the
reprogramming increases the minimum update interv al (thus decreasing the maximum update
rate).
A page boundary in an interleaved DMA waveform buffer or a buffer that is to be used for
32-bit digital pattern gener ation can cause unpred ictable res ults, regar dless of yo ur oper ating
speed. To avoid this problem, you should always use
Align_DMA_Buffer with interleaved
DMA waveform generation (indicated by resource = 2) and 32-bit digital pattern generation
(indicated by resource = 13). In these two cases,
Align_DMA_Buffer first attempts to align
the buffer so that the data completely avoids a page boundary. If bufferSize is not big enough
for complete alignment, the function attempts to partially align the data to ensure that a
page boundary does not cause unpredictable results. Partial alignment is possible if
National Instruments Corporation2-23NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Align_DMA_Buffer
bufferSize ≥ count + 1. If neither form of alignment is possible, the function returns an error.
Align_DMA_Buffer partially aligned the data, the function returns a memPageError
If
warning indicating that a page boundary is still in the data.
NotePhysical DMA page boundaries do not exist on EISA bus computers. However,
page boundaries can be introduced on these computers as a side effect of W indo ws
386 Enhanced mode and the Windows NT virtual memory management system.
This happens when a buffer is locked into physical memory in preparati on for a
DAQ operation. If the memory manager cannot find a contiguous space large
enough, it fragments the buffer, placing pieces of it here and there in physical
memory. This type of page boundary only affects the performance on an AT bus
computer . NI-D AQ uses the DMA chaining feature available on EISA computers
to chain across page boundaries, thus avoiding the delay involved in DMA
programming.
Align_DMA_Buffer after your application has loaded buffer with the data samples
Call
(for waveform generation or digital output) and before calling
DIG_Block_In, or DIG_Block_Out. You should pass the aligned buffer to the waveform
WFM_Op, WFM_Load,
generation and pattern generation functions the same way you would an unaligned b uffer . The
count parameter in the waveform generation or pattern generation function call should be the
same as the count parameter passed to
Align_DMA_Buffer, not bufferSize.
If you want to access the data in buffer after calling
Align_DMA_Buffer, access the data
starting at buffer[alignIndex] (if your array is zero based).
After using an aligned buffer for waveform generation or pattern generation, NI-DAQ
unaligns the data. After the buffer has been unaligned, the first data sample is at offset zero
of the buffer again. If you want to use the buffer for waveform generation or pattern
generation again after it has been unaligned, you must make another call to
Align_DMA_Buffer before calling WFM_Op, WFM_Load, DIG_Block_In, or
DIG_Block_Out.
See Waveform Generation A pplication Hints and Digital I/O Application Hints in Chapter 3,
Software Overview, of the NI-DAQ User Manual for PC Compatibles for more information
on the use of
Align_DMA_Buffer. See Chapter 4, DMA and Progra mmed I/O Performance
Limitations, of the NI-DAQ User Manual for PC Compatibles for a discussion of DMA page
status = AO_Calibrate (deviceNumber, operation, EEPROMloc)
Purpose
Loads a set of calibration constants into the calibration DACs or copies a set of calibration
constants from one of four EEPR OM areas to EEPR OM area 1. You can load an existing set of
calibration constants into the calibration D A Cs fr om a storage area in the onboard EEPROM.
You can copy EEPROM storage areas 2 through 5 (EEPROM area 5 contains the factory
calibration constants) to storage area 1. NI-D A Q automatically loads the calibration constants
stored in EEPROM area 1 the first time a function pertaining to the AT-AO-6/10 is called.
Note
Use the calibration utility provided with the AT-AO-6/10 to perform a calibration
procedure. Refer to the calibration chapter in the AT-AO-6/10 User Manual for
more information regarding the calibration procedure.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
operationi16operation to be performed
EEPROMloci16storage location in the onboard EEPROM
Parameter Discussion
operation determines the operation to be performed.
1:Load calibration constants from EEPROMloc.
2:Copy calibration cons tants from EEPROMloc to EEPROM user calibration
area 1.
EEPROMloc selects the storage location in the onboard EEPROM to be used. You can use
different sets of calibration constants to compensate for configuration or environmental
changes.
1:User calibration area 1.
2:User calibration area 2.
3:User calibration area 3.
4:User calibration area 4.
5:Factory calibration area.
National Instruments Corporation2-25NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_Calibrate
Using This Function
When NI-DAQ initializes the AT-AO-6/10, the DAC calibration constants stored in
EEPROMloc 1 (user calibration area 1) provide the gain and offset values used to ensure
proper device operation. In other words,
AO_Calibrate with operation set to 1 and EEPROMloc set to 1. When the AT-AO-6/10
leaves the factory, EEPROMloc 1 contains a copy of the calibration constants stored in
EEPROMloc 5, the factory area.
A calibration procedure performed in bipolar mode is n ot valid for unipolar and vice versa.
See the calibration chapter of the AT-AO-6/10 User Manual for more infor mation r e g a rdin g
calibrating the device.
status = AO_Change_Parameter (deviceNumber, channel, paramID, paramValue)
Purpose
Selects a specific parameter setting for the analog output section of the device or an analog
output channel. You can select parameters related to analog output not listed here through the
AO_Configure function.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
channeli16number of channel you w ant to configure; you can
use –1 to indicate all channels
paramIDu32identification of the parameter y ou want to change
paramVal ueu32new value for the parameter specified by
paramID
Parameter Discussion
Legal ranges for paramID and paramValue are given in terms of constants defined in a
header file. The header file you should use depends on the language you are using:
•C programmers—
•B ASIC programmers—
refer to the Programming Language Considerations in Chapter 1, Using the NI-DAQ Functions, for more information.)
•Pascal programmers—
Legal values fo r channel depend on the type of devi ce you are using ; analog outp ut channel s
are labeled 0 through n–1, where n is the number of analog output channels on your device.
You can set channel to –1 to indicate that you want the same parameter selection for all
channels. You must set channel to –1 to change a parameter you cannot change on per
channel basis.
National Instruments Corporation2-27NI-DAQ FRM for PC Compatibles
NIDAQCNS.H (DATAACQ.H for LabWindows/CVI)
NIDAQCNS.INC (V isual Basic for Windo ws programmers should
NIDAQCNS.PAS
Chapter 2Function Reference — AO_Change_Parameter
Legal values for paramValue depend on paramID. The following paragraphs list features
you can configure al ong with le gal v alues for paramID with expl anations and corr esponding
legal values for paramValue.
Reglitching
Every time you change the state of your DAC, a very small glitch is generated in the signal
generated by the DAC. When reglitching is turned off, glitch size de pends on the binary
patterns that are written into the DA C; the glitch is largest when the most significant bit in the
pattern changes (when the wav efor m crosses the midrange of the DAC); it is smaller in other
cases. When reglitching is turned on, the glitch size is much less dependent on the bit pattern.
To change the reglitching parameter, set paramID to
ND_REGLITCH.
If you are not concerned about this, you are li kely to be satisf ied by the def ault values NI- DA Q
selects for you if y ou do not call th is functi on. The fo llo wing ta ble list s de vices on whi ch you
can change this parameter.
If you turn off reglitching on the AT -MIO-16X, timing problem s tha t NI-DAQ cannot detect might occur.
Voltage or Current Output
Some devices require separate calibration constants for voltage and current outputs. Setting
the output type to voltage or current for these devices causes the driver to use the correct
calibration constants and to interpret the input data correctly in
output type, set paramID to
For the VXI-AO-48XDC device the
with the channel value to select the analog output channel to be affected. To select a voltage
channel, set the
paramValue
paramValue
to
ND_CURRENT
FIFO Transfer Condition
You can specify the condition that causes more data to be transferred from the waveform
buffer into the analog output FIFO. NI-DAQ selects a default setting for you, in order to
achieve maximum performance. However, by changing this setting, you can force the FIFO
to remain as full as possible, or effectively disable, or reduce the size of the FIFO.
For example, to reduce the FIFO lag effect (the amount of time it takes data to come out of
the FIFO after being transferred into the FIFO), you can change the FIFO transfer condition
to FIFO empty. Notice that reducing the effective FIFO size can also reduce the maximum
sustainable update rate.
Table 2-4.
Voltage or Current Output Parameters
Per Channel
Selectio n Po ssib le
Yes
to
ND_VOLTAGE
.
Legal Range for
paramValue
ND_CURRENT_OUTPUT
and
ND_VOLTAGE_OUTPUT
of
paramID
ND_OUTPUT_TYPE
. To select a current channel, set the
Default Setting for
paramValue
ND_VOLTAGE_OUTPUT
is used in conjunction
To change the FIFO transfer condition, set
and set
paramValue
to one of the values shown in Table 2-5:
Table 2-5.
Parameter Values for FIFO Transfer Conditions
paramID
to
ND_DATA_TRANSFER_CONDITION
Transfer ConditionNI-DAQ Constant
FIFO not full
FIFO half-full or less
FIFO empty
FIFO half-full or less until full
ND_FIFO_NOT_FULL
ND_FIFO_HALF_FULL_OR_LESS
ND_FIFO_EMPTY
ND_FIFO_HALF_FULL_OR_LESS_UNTIL_FULL
(DMA only)
Set
channel
configured group 1 to contain channels 0 and 1, you can set
National Instruments Corporation2-29NI-DAQ FRM for PC Compatibles
to one of the channel numbers i n your wav eform group. F or example, if yo u have
channel
to 0 or 1.
This option is valid only for PCI E Series devices.
,
Chapter 2Function Reference — AO_Change_Parameter
When using PCI E Series devices with DMA (default data transfer condition), the device has
an effective FIFO size 32 samples larger than the FIFO size specified for the board. This is
due to a 32-sample FIFO on the miniMITE, the onboard DMA controller used for DMA
transfers.
FIFO Transfer Count
The FIFO transfer count specifies the number of samples to be transferred fro m the waveform
buffer into the analog output FIFO when FIFO requests are generated. This option is for use
in conjunction with the FIFO transfer condition, as described above.
AO_Change_Parameter should be called once to set the FIFO transfer condition, and can
optionally be called again to specify the FIFO transfer count. If you d o not specify th e FIFO
transfer count, NI-DAQ chooses an appropriate value for you.
The value of FI FO tr ans fer count i s used dur ing interrupt-driven waveform generation but is
ignored duri ng DMA-driven waveform ge neration. When you use DMA, DM A requests a re
generated as long as the transfer condition is true.
Table 2-6 contains the def ault values that are used if you do n ot specify FIFO transfer coun t,
in addition to the valid values that can be set.
Table 2-6.
Default Values for FIFO Transfer Condition
Transfer ConditionDefault Transfer CountValid Input Valu es
FIFO not full11
FIFO half-full or lesshalf-FIFO size1—half-FI F O size
FIFO empty11—FIFO size
FIFO half-full or less until
full (DMA only)
FIFO transfer count cannot be
specified for this transfer
N/A
condition
For example, if you choose the FIFO empty transfer condition and set the transfer count to
10, each time the board is interrupted with a FIFO empty interrupt, NI-DAQ transfers 10
samples from the user buffer into the analog output FIFO. Although this does not improve the
maximum sustainable update rate, it redu ces the nu mber of interrupts, and reduces the FIFO
lag effect to a maximum of 10 samples.
If you choose the FIFO half full or less transfer condition and set the transfer count to 100
on a board with a 2048-sample FIFO, the FIFO fills with a maximum of 1124 samples (half
the FIFO plus 100 samples). Each time the number of samples in th e FIFO falls to less than
1024, another interrupt is generated, at which time 100 samples are transferred from the
waveform buffer to the FIFO.
To change the FIFO transfer count, set paramID to ND_FIFO_TRANSFER_COUNT and use
paramValue to pass in a 32-bit in teger.
Set channel to one of th e channel numbers in yo ur wav eform group. F or example, if you ha ve
configured group 1 to contain channels 0 and 1, you can set channel to 0 or 1.
NoteThis option is valid only for PCI E Series devices.
Ground DAC Reference
You can ground the reference that the analog output channels use, which causes the output
voltage to remain at 0 V, regardless of the value you write to the channel.
To change the grounding of the DAC Reference, set paramID to
ND_GROUND_DAC_REFERENCE, and set paramValue to either ND_YES, or ND_NO. The effect
is immediate. Also, groundi ng the D A C r eference on one channel has the ef fect of gro unding
it for both channels, so you can specify either 0 or 1 for channel number.
NoteThis option is valid only for PCI E Series devices.
Analog Filter
Some devices have a lowpass analog filter after the DAC. You can switch this filter ON or
OFF . By switching this filter OFF, the analog lowpass filter stage is bypassed. T o change the
digital filter setting, set paramID to
ND_ANALOG_FILTER.
Table 2-7.
Device Type
DAQA rb AT-5411
DAQArb PCI- 5411
Parameter Setting Information for the Analog Filter
Per Channel
Selection Possible
Legal Range
for paramValue
YesND_ON and
ND_OFF
Default Setting
for paramValue
ND_ON
Digital Filter
Some devices have a lowpass digital filter before the DAC. You can switch this filter ON or
OFF. By switching this filter OFF, the digital lowpass filter stage is bypassed.
To change the digital filter setting, set paramID to
Table 2-8.
Parameter Setting Information for the Digital Filter
National Instruments Corporation2-31NI-DAQ FRM for PC Compatibles
ND_DIGITAL_FILTER.
Legal Range
for paramValue
ND_OFF
Default Setting
for paramValue
ND_ON
Chapter 2Function Reference — AO_Change_Parameter
Output Enable
On some of the devices, you can di sable t he output e v en when th e wa v eform generation is in
progress. You can use this feature to bring the output to a known level at any time.
On DAQArb 5411 devices, th ere is a relay just in front of the I/ O connector . By disabling the
output, this relay switches so that the I/O connector output shorts to ground. The waveform
generation can still continue, but no signal appears at the I/O connector output. You can
enable or disable the output at any time.
To change the output enable setting, set paramID to
On some of the devices, you can select the output impedance to match the impedance of
the load.
Output impedance of 50 Ω is good for testing most of the devices. You can use output
impedance of 75 Ω for video testing. If you select an output impedance of 0 Ω, you shoul d be
driving an unterminated load (that is, a load with a very high input impedance).
To change the output impedance setting, set paramID to
Note
The values are set up in milliOhms (mΩ).
Table 2-9.
Table 2-10.
ND_OUTPUT_ENABLE.
Parameter Setting Information for Output Enable
Per Channel
Selection Possible
Legal Range
for paramValue
YesND_YES and
ND_NO
ND_IMPEDANCE.
Parameter Setting Information for Output Impedance
Some devices hav e attenuators after the f inal amplifier stage. By attenuating the output signa l,
you do not lose any dynamic range of the signal; that is, you do not lose any bits from the
digital representation of the signal, because the attenuation is done after the DAC and not
before it.
Chapter 2Function Reference — AO_Change_Parameter
Attenuation (in mdB) = - [20 log
= The voltage level that you want for the output signa l .
V
o
= The input voltage level.
V
i
For DAQArb5411 devices, V
(Vo/Vi)]*1000
10
= -5 to +5 V for terminated load and -10 to +10 V for
i
unterminated load. For example, to change the output levels to –2.5 to +2.5 V into a
terminated load, then:
Attenuation = –[20*log
2.5/5)]*1000 = 6020 mdB
(
10
The 4451 and 4551 devices have three levels of attenuation providing voltage ranges of
–10 to + 10 V, –1 to +1 V, and –100 to +100 mV.
T o change the output attenuation setting set paramID to
ND_ATTENUATION. You can change
the attenuation at any time.
Note
The values are set up in millidecibels.
Table 2-11.
Parameter Setting Information for Output Attenuation
Legal Range
Device Type
DAQA rb AT-5411
DAQArb PCI- 5411
Per Channel
Selection Possible
Yes0 through
for
paramValue
74,000
Default Setting
for paramValue
0
4451 and 4551 devicesYes0, 20,000,
0
40,000
Frequency Correction for the Analog Filter
Some devices have an analog lowpass filter in their output stage. To correct for
the abnormalities of this filter at a particular frequency, set paramID to
ND_FILTER_CORRECTION_FREQ. You can set the paramValue to 0 to disable the
frequency correction for the analog filter. If you have disabled the analog filter, you also
must disable the frequency correction.
National Instruments Corporation2-33NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_Change_Parameter
Table 2-12.
Device Type
DAQA rb AT-5411
DAQArb PCI- 5411
Trigger Mode
Some devices can generate the waveforms stored in the memory on board in different ways
by setting the trigger mode parameter.
The following trigger modes are possible on the DAQArb 5411 devices:
SingleThe waveform described by the user in the sequence list
ContinuousThe waveform described by the user in the sequence list is
SteppedAfter the start trigger, the waveform described by the first
BurstAfter the start trigger has been implemented, the waveform
Parameter Setting Information for Frequency Correction for the Analog Filter
Legal Range
Per Channel
Selection Possible
for
paramValue
Default Setting
for paramValue
Yes0 through
16,000,000
generated once by going through all the sequence list. Only a
start trigger is required.
generated infinitely by recycling through all of the sequence list.
Only the start trigger is required.
sequence entry is generated. It then waits for another trigger. At
the time of triggering, the waveform described by the second
sequence entry is generated, and so on. When all of the sequence
list is exhausted, it returns to the first sequence entry.
described by the first sequence entry is generated until another
trigger is implemented. At the time of triggering, the earlier
waveform is completed before the waveform described by the
second sequence entry is generated and so on. When all of the
sequence list is exhausted, it returns to the first sequence entry.
0
1
is
To change the trigger mode setting, set paramID to
1
A sequence list is used in staging-based waveform generation for linking, loop ing, and
generating multiple waveforms stored on the onboard memory. The sequence list has a list of
entries. Each entry is called a stage. Each stage specifies which waveform to generate and the
other associated settings for that waveform (for example, the number of loops). For more
details on staging-based waveform generation, refer to
details on triggering and trigger sources, refer to your DAQArb 5411 User Manual.
On some of the devices, you can phase-lock the internal timebase to an external reference
clock. The internal timebase can be an integral multiple of the external reference clock. This
feature is useful because you can synchronize the timebases of multiple devices so that they
are all locked to each other.
On DAQArb 5411 devices, you can phase-lock the internal timebase to a non-National
Instruments device using the I/O connector or to a National Instruments devi ce using the R TSI
connector. You can select the reference clock source by using the
call. If the PLL reference clock source is the R TSI clock, set the refer ence clock frequenc y to
20 MHz.
To change the PLL reference frequency, set paramID to
Note
The values are set up in Hertz (Hz).
Parameter Setting Information for the Trigger Mode
Per Channel
Selection Possible
Yes
Legal Range
for paramValue
ND_SINGLE
ND_CONTINUOUS
ND_BURST
ND_STEPPED
ND_PLL_REF_FREQ.
Default Setting
for paramValue
ND_CONTINUOUS
Select_Signal function
Table 2-14.
Parameter Setting Information for PLL Reference Frequency
Legal Range
Device Type
DAQA rb AT-5411
DAQArb PCI- 5411
Per Channel
Selection Possible
Yes1,000,000,
for
paramValue
10,000,000,
Default Setting
for paramValue
1,000,000
20,000,000
SYNC Duty Cycle
The SYNC output is a TTL version of the sine waveform being generated at the output. It is
obtained by using a zero-crossing detector on the sine output. It is generated on a separate
output connector instead of the main analog output connector. The SYNC output might not
carry any meaning for any other types of waveforms being generated.
You can vary the duty cycle of TTL output on the fly. To change the SYNC duty cycle as
.
the percentage of the time high, set paramID to
ND_SYNC_DUTY_CYCLE_HIGH
paramValue parameters imply p e rcentag e (% ). To disable the SYNC output, set the
National Instruments Corporation2-35NI-DAQ FRM for PC Compatibles
The
Chapter 2Function Reference — AO_Change_Parameter
paramValue to 0 or 100. By setting it to 0, the SYNC output goes to 0 V . If you set it to 100,
it goes to +5 V.
Table 2-15.
Device Type
DAQA rb AT-5411
DAQArb PCI- 5411
Using This Function
Use this function to cust o mize t he behavior of the analog ou t put s ect ion of your devi ce. Call
this function before calling NI-DAQ functions that cause output on the analog output
channels. You can call this function as often as needed.
End of Buffer Interrupts
On PCI E Series boards that use the PCI-MITE for DMA transfers, NI-DAQ causes the
PCI-MITE to generate an interrupt after a full buffer has been transferred from host memory
to the DAQ device. With one-shot operations, where the buffer is only output once, or even
during continuous operations where the buffer is very large, these interrupts place very little
burden on the system. However, wh en outputting a large number of iterations with small
buffers or at high speeds, these interrupts can affect overall system performance.
These interrupts are generated so that NI-DAQ will read the state of the DMA controller and
track the number of itera tions and t he number o f points tr ansferred si nce the be ginnin g of the
operation. The PCI-MITE has a 32-bit counter that counts bytes transferred. The only
drawback in turning off these interrupts is that NI-D AQ might not have a chance to detect an
overflow of the counter. For example, when generating a waveform on one channel at 1 M
samples/s, the count er will ov erflo w in 36 minutes. If you disable end- of-buf fer interr upts and
do not query NI-DAQ for status information before the counter overflows, NI-DAQ will not
be able to take the overflow into account, and the status information returned could be
incorrect.
Parameter Setting Information for the SYNC Duty Cycle
Legal Range
Per Channel
Selection Possible
for
paramValue
Yes20 to 8050
Default Setting
for paramValue
To enable/disable end of buffer interrupts, set paramID to
ND_LINK_COMPLETE_INTERRUPTS and set paramValue to either ND_ON or ND_OFF. You
may specify any channel in the waveform group, and the setting will apply to all channels in
the group.
Note
NI-DAQ FRM for PC Compatibles2-36
This option is valid only for PCI/CPCI/PXI E Series devices.
When doing waveform generation on PCI E Series boards that use the PCI-MITE for DMA
transfers, NI-DAQ transfers data from host memory to the DA Q de vice 16 bits at a time. This
allows for the finest le vel of contro l and is necessary to properly support features lik e old data
stop and partial transfer stop (see the NI-DAQ function
It is also possible to transfer data from host memory to the DAQ de vice 32 bits at a time, which
requires fewer PCI b us cycles so that the D A Q de vice functions more effecti vely with the PCI
bus. The only drawback is that when using old data stop and partial transfer stop, the
waveform may stop one sample earlier than you would otherwise expect.
WFM_DB_Config).
To set the memory transfer width, set paramID to
ND_MEMORY_TRANSFER_WIDTH and set
paramValue to either 16 or 32. You may specify any channel in the w aveform group, an d the
setting will apply to all channels in the group.
Note
This option is valid only for PCI/CPCI/PXI E Series devices. For 61XX devices,
only even-sized buffers are allowed, and the memory transfer width is always
32 bits.
National Instruments Corporation2-37NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_Configure
AO_Configure
Format
status = AO_Configure (deviceNumber, chan, outputPolarity, intOrExtRef, refVoltage,
updateMode)
Purpose
Informs NI-D AQ of the output range and polarity selected for each analog output chan nel on
the device and indic ates the update mode of the D ACs. If you have recorded an analog outp ut
configuration that is not a default through the NI-DAQ Configuration Utility, you do not need
AO_Configure because NI-DAQ uses the settings recorded by the NI-DAQ
to use
Configuration Utility. If you have a software-configurable device, you can use
AO_Configure to change the analog output configuration on the fly.
Caution
!
For the AT-AO-6/10, NI-DAQ records the configuration information for output
polarity and update mode in chan nel pairs. A call to
same output polarity and update mode selections for both channels in a pair.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog output channel number
outputPolarityi16unipolar or bipolar
intOrExtRefi16reference source
refVoltagef64 voltage reference value
updateModei16when to update the DACs
Parameter Discussion
chan is the analog output channel number.
Range:0 or 1 for the AO-2DC, Lab and 1200 Series analog output devices, and MIO
devices.
0 through 5 for the AT-AO-6.
0 through 9 for the AT-AO-10.
0 through 47 for the VXI-AO-48XDC.
0 for DAQArb 5411 devices.
outputPolarit y indicates whether the analog output channel is configured for unipolar or
bipolar operation.
For the AT-AO-6/10 and MIO devices (except the MIO-16XE-50 devices):
0: Bipolar operation (default settin g, o ut put range is from –refVoltage to
+refVoltage).
1: Unipolar operation (output range is from 0 to +refVoltage).
For the Lab and 1200 Series analog output devices:
0: Bipolar operation (default settin g, o ut put range is from –5 to +5 V).
1: Unipolar operation (output range is from 0 to +10 V).
For the MIO-16XE-50 devices:
0: B i polar operation (output range is from 0 from –10 to +10 V).
For the AO-2DC devices:
0: Bi polar operation (out put range is from –5 to +5 V).
1: Unipolar operation (default setting, output range is from 0 to +10 V or
0to20mA).
For the VXI-AO-48XDC:
0:Bipolar operation (voltage only; output range is from –10.24 to +10.24 V).
1:Unipolar operation (current only; output range is from 0 to 20.47 mA).
For the DAQArb 5411 devices:
0:Bipolar operation (output range is –5 to +5 V for a 50 Ω te rminated load and –10
to +10 V for an unterminated load—that is, a load with a very high im pedance).
intOrExtRef indicates the source of voltage reference.
0:Internal reference.
1:External reference.
The MIO devices, except the 16-bit E Series devices, and AT-AO-6/10 devices support
external analog output voltage references.
For DAQArb 5411 devices, only internal reference is supported.
refVoltage is the analog output channel voltage reference value. You can configure each
channel to use an internal reference of +10 V (the default) or an external referen ce. Although
each pair of channels is served by a single external reference connection, the conf iguration of
the external reference operates on a per channel basis. Therefore, it is possible to have one
channel in a pair internally referenced and the other channel in the same pair externally
referenced.
National Instruments Corporation2-39NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_Configure
If you make a reference voltage connection, you must assign refVoltage the value of the
external reference voltage in a call to
AO_Configure for the AO_VWrite and AO_VScale
functions to operate properly . F or devices that ha ve no external re ference pin, the output range
is determined by outputPolarity, and NI-DAQ ignores this parameter.
updateMode indicates whether an analog output channel is updated when written to:
0:Updated when written to (default sett ing).
1:Not updated when written to, but up dated later aft er a call to
(later internal update mode).
2:Not updated when written to, but updated later upon application of an active low
pulse. You should apply this pulse to the following:
•OUT2 pin for an MIO-16/16D devi ce
•EXTDACUPDATE pin for an MI O-F/16 devic e
•EXTUPDATE pin for the AT -AO-6 /10 and La b and 1200 Seri es analo g
output devices (late r exte rn al upda te mode )
•PFI5 pin for the E S eries devices. To alter the pin and pol a rity selection s
you make with this function, for an E Series device , you can ca ll
Select_Signal with signal = ND_OUT_UPDATE after you call
AO_Configure.
NoteThis mode is not valid for the VXI-AO-48XDC.
AO_Update
Using This Function
AO_Configure stores information about the analog output channel on the specified device
in the configuration table for the analog channel. For the AT-AO-6/10, the outputPolarity
and updateMode information is stored for channel pairs. For example, analog output
channels 0 and 1 are grouped in a channel pair, and a call to
record the outputPolarity and updateMode for both channels 0 and 1. Likewise, a call to
AO_Configure for channel 1 records the outputPolarity and updateMode for both
channels 0 and 1. The AT-AO-6/10 channel pairs are as follows:
AT-AO-6/10 channel pairs:
AO_Configure stores information abou t the analog output channe l on the specified bo ard in
the configuration table for the analog channel. The analog output channel conf iguration table
defaults tables default to the following:
•MIO device and AT-AO-6/10:
outputPolarity = 0: Bipolar.
refVoltage = 10 V.
updateMode = 0: Update when written to.
•Lab and 1200 Series analog output devices:
outputPolarity = 0: Bipolar (–5 to +5 V).
updateMode = 0: Updated when written to.
•VXI-AO-48XDC:
outputPolarity = 0; Bipolar (–10.24 to +10.24 V).
updateMode = 0: Updated when written to.
If you configure an output channel for later internal update mode (updateMode = 1), you
can configure no other output channels for later external update mode (updateMode = 2).
Likewise, if you configure an output channel for later external update mode, you can
configure no other output channels for later internal update mode.
If the physical configuration (the jumpered settings) of the analog output channels on your
device differs from the default setting, you must call
AO_Configure with the true
configuration information for the remaining analog output functions to operate properly.
NoteThe AT-AO-6/10 allows you to physically configure each analog output channel
(the jumper setting) f or bipolar or unipolar op eration. T o ens ure proper operation,
configure both channels in a channel pair the same way.
On the AT-MIO-16X, A T-MIO-64F-5, and E Ser ies dev ices (except MIO-16XE-50 de vices),
the calibration constants used for analog output change depending on the polarity of the
analog output channels. NI-DAQ always ensures that the calibration constants in use match
the current polarity of the channels.
If you change the polarity on the AT-MIO-16X or the AT-MIO-64F-5 by calling
AO_Configure, NI-DAQ checks if the load area contains the appropriate constants. If so,
NI-DA Q loads the constants from the load ar ea. Otherwise, NI-D A Q loads the co nstants from
the factory area for the current polarity and return status code
calConstPolarityConflictError. The actual loading of calibration constants takes place
when you call an
AO or WFM function. See the Calibrate_E_Series function description
for information about calibration constant loading on the E Series devices.
To load constants from some other EEPROM area, you must call the
status = AO_VScale (deviceNumber, chan, voltage, binVal)
Purpose
Scales a voltage to a binary value that, when written to one of the analog output channels,
produces the specified voltage.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog output channel number
voltagef64voltage, in volts, to be converted to a binary value
Chapter 2Function Reference — AO_VScale
Output
NameTypeDescription
binVali16converted binary value returned
Parameter Discussion
chan is the analog output channel number.
Range:0 or 1 for the Lab and 1200 Series analog output devices, and MIO devices.
0 through 5 for AT-AO-6.
0 through 10 for AT-AO-10.
0 through 47 for the VXI-AO-48XDC.
Note
C Programmers—binVal is a pass-by-reference parameter.
Using This Function
Using the following formula, AO_VScale calculates the binary value to be written to the
specified analog output channel to generate an output voltage corresponding to voltage.
binVal = (voltage/refVoltage) * maxBinVal
where values of refVoltage and maxBinVal are appropriate for your device and current
configuration.
National Instruments Corporation2-43NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_VScale
Notice that refVoltage is the value you specify in AO_Configure. Because you can
independently configure the analog output channels for range and polarity, NI-DAQ can
translate the same voltage to different values for each channel.
NoteSome inaccuracy results in the
the VXI-AO-48XDC, because this device works with a larger analog output
resolution than can be represented by the 16-bit binary output value for
.
AO_VScale
The binary output value is designated as the most significant 16 bits
of the scaling operation to minimize this inaccuracy. Use the
to prevent this kind of inaccuracy.
Accepts a floating-point voltage value, scales it to the proper binary number , and writes that
number to an analog output or current channel to change the output voltage.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog output channel number
voltagef64floating-point value to be scaled and written
Parameter Discussion
chan is the analog output channel number.
Range:0 or 1 for the AO-2DC, Lab and 1200 Series analog output, and MIO devices.
0 through 5 for AT-AO-6.
0 through 9 for AT-AO-10.
0 through 49 for the VXI-AO-48XDC.
Chapter 2Function Reference — AO_VWrite
voltage is the floating-point value to be scaled and written to the analog output channel. The
range of voltages depends on the type of device, on the jumpered output polarity, and on
whether you apply an external voltage reference.
•Default ranges (bipolar, internal voltage reference):
MIO device:–10 to +10 V
AT-AO-6/10:–10 to +10 V
Lab and 1200 Serie s
analog output devi ces:–5 to +5 V
VXI-AO-48XDC:–10.24 to +10.24 V
•Default ranges (unipolar, internal voltage reference):
AO-2DC device:0 to +10 V
National Instruments Corporation2-45NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — AO_VWrite
If you set the output type to current by calling AO_Change_Parameter, the floating-point
value indicates the current in amps.
Default ranges (unipolar, internal voltage reference):
AO-2DC device:0 to 0.02 A
VXI-AO-48XDC:0 to 0.02047 A
Using This Function
AO_VWrite scales voltage to a binary value and then writes that value to the DAC in the
analog output channel. If the analog output channel is configured for immediate update, the
output voltage or current changes immediately. Otherwise, the output voltage or current
changes on a call to
If you have chan ged the output polarit y for the analog output ch annel from the factory setting
of bipolar to uni polar , yo u must call
correctly scale the floating-point value to the binary value.
You also can use th is function to calibrate the VXI-AO-48XDC. On this device, writes to
channel number 48 affect the voltage or current offset calibration, depending on the output
type of this channel as set by the
channel number 49 affect the voltage or current gain calibration, which also depends on the
output type of the channel as set by the
AO_Update or the application if an external pulse.
AO_Configure with this information for AO_VWrite to
AO_Change_Parameter function. In addition, writes to
Writes a binary value to one o f the analog output channels, chan ging the v o ltage produ ced at
the channel.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
chani16analog output channel number
valuei16digital value to be written
Parameter Discussion
chan is the analog output channel number.
Range:0 or 1 for Lab and 1200 Series analog output and MIO devices.
0 through 5 for AT-AO-6.
0 through 9 for AT-AO-10.
0 through 47 for the VXI-AO-48XDC.
Chapter 2Function Reference — AO_Write
value is the digital value to be written to the analog output channel. value has several r anges,
depending on whether the analog output channel is configured for unipolar or bipolar
operations and on the analog output resolution o f the device as shown in the following table.
DeviceBipolarUnipolar
Most devices–2,048 to +2,0470 to +4,095
AT-MIO-16X, 16-bit E Series devices–32,768 to +32,7670 to +65,535
Using This Function
AO_Write
output channel for immediate update, which is the default setting, the output voltage or
current changes immediately. Otherwise, the output voltage or current changes on a call to
AO_Update or the application of an external pulse.
National Instruments Corporation2-47NI-DAQ FRM for PC Compatibles
writes value to the DAC in the analog outp ut channel. If you configu re the analog
Chapter 2Function Reference — AO_Write
NoteSome inaccuracy results when you use AO_Write on the VXI-AO-48XDC,
because this device works with a larger analog output resolution than can be
represented by the 16-bit value parameter. value repr esents the most significant
16 bits of the DAC, in order to minimize this inaccuracy. Use the
function to prevent this type of inaccuracy.
status = Calibrate_1200 (device, calOP, saveNewCal, EEPROMloc, calRefChan, grndRefChan,
DAC0chan, DAC1chan, calRefVolts, gain)
Purpose
The 1200 and 1200AI devices come fully equipped with accurate factory calibration
constants. Howe ve r , if you feel that the device is not performing eith er analog input or outpu t
accurately and suspect the device calibration to be in error , you can use
obtain a user-defined set of new calibration constants.
A complete set of calibration constants consists of ADC constants for all gains at one polarity
plus DAC constants for both DACs, again at the same polarity setting. It is important to
understand the polarity rules. The polarity your device was in when a set of calibration
constants was created must match the polarity your device is in when those calibration
constants are used. For example, calibration constants created when your ADC is in unipolar
must be used only for data acquisition when your ADC is also in unipolar.
You can store up to six sets of user-defined calibration constants. These are stored in the
EEPROM on yo ur de v ice in plac es called user calibration ar eas. Refer to your h ardw are user
manual for more information on these calibration areas. You also can use the calibration
constants created at the factory at any time. These are stored in write protected places in the
EEPROM called factory calibration areas. There are two of these. One holds constants for
bipolar operation and the other for unipolar. One additional area in the EEPROM important
to calibration is called the default load table. This table contains four pointers to sets of
calibration constants; one pointer each for ADC unipolar constants, ADC bipolar constants,
DAC unipolar and DAC bipolar. This tab le is u sed by NI-DAQ for calibration constant
loading.
Calibrate_1200 to
It is also important to understand the calibration constan t loading rules. The first time a
function requiring use of the ADC or DAC is called in an application, NI-DAQ automatically
loads a set of calibration constants. At that ti me, th e polarities of your ADC and DACs are
examined and the appropriate pointers in the default load table are used. The calibration
constant loading is done after the DLL is loaded. If your DLL is ever unloaded and then
reloaded again, the calibration constant loading is also done again.
National Instruments Corporation2-49NI-DAQ FRM for PC Compatibles
Calling this function on an SCXI-1200 with remote SCXI might take an extremely
long time. We strongly recommend that you switch your SCXI-1200 to use a
parallel port connection before performing the calibration and store the
calibration constants in one of the EEPROM storage locations.
Chapter 2Function Reference — Calibrate_1200
CautionRead the calibration chapter in your device user manual before using
!
Calibrate_1200.
Parameters
Input
NameTypeDescription
devicei16device number
calOPi16operation to be performed
saveNewCali16save new calibration constants
EEPROMloci16storage location on EEPROM
calRefChani16AI channel connected to the calibration voltage
grndRefChani16AI channel that is grounded
DAC0chani16AI channel connected to DAC0
DAC1chani16AI channel connected to DAC1
calRefVolts f64DC calibration voltage
gainf64gain at which ADC is operating
Parameter Discussion
calOP determines the operation to be performed.
1:Load calibration constants from EEPROMloc. If EEPROMloc is 0, the default
load table is used and NI-DAQ ensures that the constants loaded are appropriate
for the current polarity settings. If EEPROMloc is any other value you must
ensure that the polarity of your device matches those of the calibration constants.
2:Calibrate the ADC using DC reference voltage calRefVolts connected to
calRefChan. To calibrate the ADC, you must ground one input channel
(grndRefChan) and connect a voltage reference between any other channel and
AGND (pin 11). After calibration, the calibration constants that were obtained
during the process remain in use by the ADC until the device is initialized again.
NoteThe ADC must be in referenced single-ended mode for successful calibration of
the ADC.
3:Calibrate the DACs. DAC0chan and DAC1chan are the analog input channels
to which DAC0 and DAC1 are connected, respectively. To calibrate the DACs,
you must wrap-back the DAC0 out (pin 10) and DAC1 out (pin 12) to any two
analog input channels. After calibration, the calibration constants that were
obtained during the process remain in use by the DACs until the device is
initialized again.
NoteThe ADC must be in referenced single-ended and bipolar mode and fully
calibrated (using calOP = 2) for successful calibration of the DACs.
4:Reserved.
5:Edit the default load table so that the set of constants in the area identified by
EEPROMloc (1–6, 9 or 10) become the default calibration constants for the
ADC. NI-DAQ changes either the unipolar or bipolar pointer in the default load
table depending on the polarity those constants are intended for. The factory
default for the ADC unipolar pointer is EE PROMloc = 9. The factory default for
the ADC bipolar poin te r is EE PR OMloc = 10. You can specify any user area in EEPROMloc after you have run a calibration on the ADC and saved the
calibration constants to that user area. Or, you can specify EEPROMloc = 9 or
10 to reset the default load table to the factory calibration for unipolar and bipolar
mode respectively.
6:Edit the default load table so that the set of constan ts in the area identified by
EEPROMloc (1–6, 9 or 10) become the default calibration constants for the
DACs. NI-DAQ’s behavior for calOP = 6 is identical to that for calOP = 5. Just
substitute DAC everywhere you see ADC.
The following table summarizes the possible values of other parameters depending on the
value of calOP.
Table 2-16.
calOP
1ignored0–10ignoredignoredignoredignoredignoredignored
20 or 11–6AI chan
National Instruments Corporation2-51NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Calibrate_1200
Possible Calibrate_1200 Parameter Values (Continued)
calRefChan
ignoredignoredignoredignoredignoredignored
ignoredignoredignoredignoredignoredignored
grndRefChan
DAC0chan
DAC1chan
calRefVolts
calOP
5ignored1–6,
6ignored1–6,
saveNewCal
9–10
9–10
Table 2-16.
EEPROMloc
saveNewCal is valid only when calOP is 2 or 3.
0:Do not save new calibration constants. Even though they are not permanently
saved in the EEPROM, calibration constants created after a successful calibration
remains in use by your device until your device is initialized again.
1:Save ne w calibration constants in EEPROMloc (1–6).
EEPROMloc selects the storage location in the onboard EEPROM to be used. Dif ferent sets
of calibration constants can be used to compensate for configuration or environmental
changes.
0:Use the default load table (valid only if calOP = 1).
1:User calibration area 1.
2:User calibration area 2.
3:User calibration area 3.
4:User calibration area 4.
5:User calibration area 5.
6:User calibration area 6.
7:Invalid.
8:Invalid.
9:Factory calibration area for unipolar (write protected).
10:Factory calibration area for bipolar (write protected).
gain
Notice that the user cannot write into EEPROMloc 9 and 10.
calRefChan is the analog input channel connected to the calibration voltage of calRefVolt s
when calOP is 2.
Range:0 through 7.
grndRefChan is the analog input channel connected to ground when calOP is 2.
Range:0 through 7.
DAC0chan is the analog input channel connected to DAC0 when calOP is 3.
DAC1chan is the analog input channel connected to DAC1 when calOP is 3.
Range:0 through 7.
calRefVolts is the value of the DC calibration voltage connected to calRefChan when
calOP = 2.
NoteIf you are calibrating at a gain other than 1, make sure you apply a voltage so that
calRefV olts * gain is within the upper limits of the analog input range of the
device.
gain is the device gain setting at which you want to calibrate when calOP is 2 or 3. When
you perform an analog input operation, a calibration constant for that gain must be available.
When you run the
Calibrate_1200 function at a particular gain, the de vice only can be used
to collect data accurately at that gain. If you are creating a set of calibration constants that you
intend to use, you must be sure to calibrate at all gains at which you in tend to sample.
Range:1, 2, 5, 10, 50, or 100.
Using This Function
A calibration performed in bipolar mode is not valid for unipolar and vice versa.
Calibrate_1200 performs a bipol ar or unipolar calibration, or loads the bi polar or unipo lar
constants (calOP=1, EEPROMloc=0), depending on the value of the polarity parameter in
the last call to
with the wrong set of calibration constants loaded, you might produce erroneous data.
AI_Configure and AO_Configure. If analog input measurements are taken
Calibrate for a particular gain if you plan to acquire at that gain. If you calibrate the device
yourself make sure you calibrate at a gain that you are likely to use. Each gain has a different
calibration constant. When you switch gains, NI-DAQ automatically loads the calibration
constant for that part icular gain. If y ou have n ot calibrated for th at gain and sa ved the cons tant
earlier, an incorrect value is used.
To set up your own calibration constants in the user area for both unipolar and bipolar
configurations, you need to complete the following steps. The basic steps are to create and
store both unipolar and bipolar ADC cal ibration constants, and modi fy the defau lt load table
so that NI-DAQ automatically loads your constants instead of the factory constants.
Step 1. Unipolar calibration—Change the po l ari ty o f yo ur device to unipol ar (by using the
AI_Configure call or use the NI-DAQ Configuration Utility in Windows). Call
Calibrate_1200 to perform an ADC calibration, as in the following example:
where the device and EEPROMloc are the same as in the first function call.
NI-DA Q automatically modifies the ADC unipolar pointer in the default load table to point to
user area 1.
Step 2. Bipolar calibration—Change the polarity of your device to bipolar. Call
Calibrate_1200 to perform another ADC calibration (calOP = 2) with saveNewCal = 1
(save) and EEPROMloc set to a different user area (say, 2) as shown above. Next, call the
function with calOP = 5 and EEPROMloc = 2 as shown above. NI-DAQ automatically
modifies the ADC bipolar pointer in the default load table to point to user area 2. At this point,
you have set up user area 1 to be your default load area when you operate the device in
unipolar mode and user area 2 to be your default load area when you operate the device in
bipolar mode. NI-DAQ automatically handles the loading of the appropriate constants.
Failed calibrations leave your device in an incorrectly calibrated state. If you run this function
with calOp = 2 or 3 and receiv e an err or, you must reload a valid set of calibration constants.
If you have a valid set of user defined constants in one of the user areas, you can load them.
Otherwise, reload the factory constants.
NoteIf you are u sing remote SCXI, the time this function might take depends on the
baud rate settings, where slower baud rates causes this function to take longer. You
also might want to call
Timeout_Config to set the timeout limit for your device
to a longer value, if you do obtain a timeoutError from this function.
status = Calibrate_DSA (deviceNumber, operation, refVoltage)
Purpose
Use this function to calibrate your DSA device.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
operationu32operation to be performed
refVoltagef64DC calib ration voltage
Parameter Discussion
The legal range for operation is gi ven in terms of constants de fined in a header f ile. The header
file you should use depends on the language you are using:
•C programmers—
•BASIC programmers—
should refer to the Programming Language Considerations s ection in Chapter 1,
Using the NI-DAQ Functions, for more information.
•Pascal programmers—
NIDAQCNS.H (DATAACQ.H) for LabWindows/CVI)
NIDAQCNS.INC Visual Basic for Windows programmers
NIDAQCNS.PAS
operation determines the operation to be performed.
Range:
National Instruments Corporation2-55NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Calibrate_DSA
Using This Function
Your device contains calibration D/A converters (calDACs) that are used for fine-tuning the
analog circuitry. The calDACs must be programmed (loaded) with certain numbers called
calibration constants. These constants are stored in nonvolatile memory (EEPROM) on your
device. To achieve specification accur acy, you should perform an internal calibration of your
device just before a measurement session but after your computer and the device have been
powered on and allo wed to warm up for at least 15 minutes . Frequent calibration pro duces the
most stable and repeatable measurement performance.
Before the device is shipped from the factory, an external calibration is performed and the
EEPROM contains calibration constants that NI-DAQ automatically loads into the calDACs
as needed. The value of the onboard reference voltage is also stored in the EEPR OM, and th is
value is used when you subsequen tly perform a self-calibration. The calibration con stants are
recalculated and stored in the EEPROM when a self-calibration is performed. When you
perform an external calibration, NI-DAQ recalculates the value of the onboard reference
voltage and then performs a self-calibratio n. This new o nboard reference v alue is used for all
subsequent self-calibration operations. If a mistake is made when performing an external
calibration, you can restore the board’s factory calibration so that the board is not unusable.
Performing Self-Calibration of the Board
Set operation to ND_SELF_CALIBRATE to perform self-calibration of your device.
Example:
You want to perform self-calibration of your device and you want to store the new set of
calibration constants in the EEPROM. You should make the following call:
Set operation to ND_EXTERNAL_CALIBRATE to e xternally calibrate your device. The value
of the internal reference voltage will be recalculated and the board will be self-calibrated
using the new reference value.
Before calling the
Calibrate_DSA function, connect the output of your reference voltage to
analog input channel 0.
Example:
You want to externally calibrate your de vice us i ng an external reference volt age s our ce with
a precise 7.0500 V ref erence, and yo u want to store t he ne w set of cal ibration c onstants in the
EEPROM. You should make the following call:
To restore the factory value o f the intern al refere nce voltage after an external calibration, set
operation to
a mistake while performing the external calibration, or if you did not want to perform the
external calibration at all.
ND_RESTORE_FACTORY_CALIBRATION. You might want to do so if you made
National Instruments Corporation2-57NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Calibrate_E_Series
Calibrate_E_Series
Format
status = Calibrate_E_Series (deviceNumber, cal OP, setOfCalConst, calRefVolts)
Purpose
Use this function to calibrate your E Series device and to select a set of calibration constants
to be used by NI-DAQ.
Caution
!
Note
Read the calibration chapter in your device user manual before using
Calibrate_E_Series.
Analog output channels and the AO and WFM functions do not apply to the AI
E Series devices.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
calOPu32operation to be performed
setOfCalConstu32set of calibration constants or the EEPROM
calRefVoltsf64DC calibration voltage
Parameter Discussion
The legal ranges for the calOp and setOfCalConst parameters are giv en in terms of constants
that are defined in the header file. The header file you should use depends on which of the
following languages you are using:
•C programmers—
•BASIC programmers—
•Pascal programmers—NIDAQCNS.PAS
location to use
NIDAQCNS.H (DATAACQ.H for LabWindows/CVI)
NIDAQCNS.INC
calOP determines the operation to be performed.
Range:
ND_SET_DEFAULT_LOAD_AREA—Make setOfCalConst the default load area; do not
perform calibration.
ND_SELF_CALIBRATE—Self-calibrates the device.
ND_EXTERNAL_CALIBRATE—Externally calibrates the device.
setOfCalConst selects the set of calibration constants to be used by NI-DAQ. These
calibration constants reside in the onboard EEPROM or are maintained by NI-DAQ.
Range:
ND_FACTORY_EEPROM_AREA:Factory calibration area of the EEPROM. You cannot
modify this area, so you can set setOfCalConst to
ND_FACTORY_EEPROM_AREA only when calOP is set
ND_SET_DEFAULT_LOAD_AREA.
to
ND_NI_DAQ_SW_AREA:NI-DAQ maintains calibration constants internally; no
writing into the EEPROM occurs. You cannot us e this
setting when calOP is set to
ND_SET_DEFAULT_LOAD_AREA. You can use this
setting to calibrate your device repeatedly during your
program, and you do not want to store the calibration
constants in the EEPROM.
ND_USER_EEPROM_AREA:For the user calibration area of the EEPROM. If calOP
is set to
ND_EXTERNAL_CALIBRATE, the new calibration
ND_SELF_CALIBRATE or
constants is written into this area, and this area becomes
the new default load area. You can use this setting to run
several NI-DAQ applications during one measurement
session conducted at same temperature, and you do not
want to recalibrate your device in each application.
calRefVolts is the value of the DC calibration voltage connected to analog input channel 0
when calOP is
ND_SET_DEFAULT_LOAD_AREA or ND_SELF_CALIBRATE.
ND_EXTERNAL_CALIBRATE. This parameter is ignored when calOP is
Range:
12-bit E Series devices: +6.0 to +10. 0 V
16-bit E Series devices: +6.0 to +9.999 V
Using This Function
Your device contains calibration D/A converters (calDACs) that are used for fine-tuning the
analog circuitry. The calDACs must be programmed (loaded) with certain numbers called
calibration constant s. Those cons tants are stor ed in non-v olati le memory (EE PR OM) on your
device or are maintained by NI-DAQ. To achieve specification accuracy, you should
perform an internal calibration of your device just before a measurement session but after
your computer and the device have been powered on and allowed to warm up for at least
15 minutes. Frequent calibration produces the most stable and repeatable measurement
performance. The device is not affected negatively if you recalibrate it as often as you want.
Two sets of calibration constants can reside in two load areas inside the EEPROM; one set
is programmed at the factory , and the other is left for the user. One load area in the EEPROM
corresponds to one set of constants. The load area NI-DAQ uses for loading calDACs with
calibration constants is called the default load area. When you get the de vice from the factor y ,
National Instruments Corporation2-59NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Calibrate_E_Series
the default load area is the area that contains the calibration constants obtained b y calibrating
the device in the factory . NI-D AQ automatically loads the relev ant calibration constants stored
in the load area the first time you call a function (an
AI, AO, DAQ, SCAN and WFM function)
that requires them. NI-DAQ also automatically reloads calibration constants whenever
appropriate; see the Calibration Constant Loading by NI-DAQ section later in this function
for details. When you call the
ND_NI_DAQ_SW_AREA, NI-DAQ uses a set of constants it maintains in a load area that does
Calibrate_E_Series function with setOfCalConst set to
not reside inside the EEPROM.
NoteCalibration of your MIO or AI device takes some time. Do not be alarmed if the
Calibrate_E_Series function takes several seconds to execute.
NoteAfter powering on your computer, you should wait for some time (typically 15
minutes) for the entire system to warm up before performing the calibration. You
should allow the same warm-up time before any measurement session that will
take advantage of the calibration constants de termined by using the
Calibrate_E_Series function.
Note611 X d evices do not support external calibration.
CautionWhen you call the Calibrate_E_Series function with calOP set to
!
ND_SELF_CALIBRATE or ND_EXTERNAL_CALIBRATE, NI-DAQ w ill abort any
ongoing operations the device is performing and set all configurations to defaults.
Therefore, we recommend that you call
Calibrate_E_Series before calling
other NI-DAQ functions or when no other operations are going on.
Explanations about using this function for different purposes (with different values of calOP)
are given in the following sections.
Changing the Default Load Area
Set calOP to ND_SET_DEFAU LT_LOAD_AREA to change the area used for calibration constant
loading. The storage location selected by setOfCalCo nst becomes the ne w def aul t load area.
Example:
You want to make the factory area of the EEPROM default load area. You should make the
following call:
Set calOP to ND_SELF_CALIBRATE to perform self-calibration of your device. The storage
location selected by setOfCalConst becomes the new default load area.
You want to perform self-calibration of your device and you want to store the new set of
calibration constants in the user area of the EEPROM. You sh ould make the following call:
The EEPROM user area becomes the default load area.
Performing External Calibration of the Board
Set calOP to ND_EXTERNAL_CALIBRATE to perform external calibration of your device. The
storage location selected by setOfCalConst becomes the new default load area.
Chapter 2Function Reference — Calibrate_E_Series
Make the following connections before calling the
Calibrate_E_Series function:
12-bit E Series Devices16-bit E Series
1. Connect the positiv e output o f your
reference voltage source to the
analog input channel 8.
2. Connect the negati ve output of your
reference voltage source to the
AISENSE line.
3. Connect the DAC0 line (analog
output channel 0 ) to analog input
channel 0.
4. If your reference volta ge source and
your computer are floating with
respect to each other, connect the
AISENSE line to the AIGND line
1. Connect the positiv e output of your refe rence
voltage source to analog input channel 0.
2. Connect the negati ve output of y our reference
voltage source to analog input channel 8.
Note: By performing these first two
connections, you supply the reference
voltage to analog input channel 0, which
is configured for differential operation.
3. If your reference voltage source and your
computer are floating with respect to each
other, connect the negative output of your
reference voltage source to the AIGND line
as well as to analog input channel 8.
as well as to the negative output of
your reference voltage source.
Example:
Y ou w ant to perform an exte rnal calibration of your de vice using an ex ternal reference volta ge
source with a precise 7.0500 V reference, and you want NI-DAQ to maintain a new set of
calibration constants without storing them in the EEPROM. You sho uld make the following
call:
National Instruments Corporation2-61NI-DAQ FRM for PC Compatibles
Chapter 2Function Reference — Calibrate_E_Series
Calibration Constant Loading by NI-DAQ
NI-DA Q automatically loads calibration constants in to calDA Cs whene ver you call functions
that depend on them (
12-bit E Series Devices16-bit E Series Devices
AI, AO, DAQ, SCAN, and WFM functions). The following conditions apply:
• The same set of constants is
correct for both polarities of
analog input.
• One set of constants is valid for
unipolar, and another set is valid
for bipolar configuration of the
analog output channels . When you
change the polarity of an analog
output channel, NI-DAQ reloads
the calibration constants for that
channel.
• Calibration constants required by th e 16-bit
E Series devices for unipolar analog input
channels are different from those for bipolar
analog input channels. If you are acquiring
data from one channel, or if all of the channels
you are acquiring data from are conf igured for
the same polarity, NI-DAQ selects the
appropriate set of calibration constants for
you. If you are scanning se veral channels, and
you mix channels configur ed for unipolar and
bipolar mode in your scan list, NI-D A Q loads
the calibration constants appropriate for the
polarity that analog input channel 0 is
configured for.
• Analog output channels on the
A T-MIO-16XE-50 can be configured only for
bipolar operation. Therefore, NI-D A Q always
uses the same constants for t he analog outpu t
channels.
Notifies NI-DAQ applications when analog input signals meet the alarm-on or alarm-off
condition you specified. Also, NI-DAQ sends your application a message or executes a
callback function that you provide.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
modei16add or remove high/low alarm events
chanStrSTRchannel string
trigLevelf64trigger level in volts
deadbandWidthf64the width of the alarm deadband in volts
handlei16handle
alarmOnMessagei16user-defined alarm-on message
alarmOffMessagei16user-defined alarm-off message
callbackAddru32user callback function address
Parameter Discussion
mode indicates whether to add a new alarm message or remove an old alarm message with
the given device.
0:Add a high alarm deadband event.
1:Add a low alarm deadband event.
2:Remove a high alarm deadband event.
3:Remove a low alarm deadband event.
chanStr is a string description of the trigger analog channel or digital port.
The channel string has one of the following formats:
xn
SCn!MDn!CHn
AMn!n
where
x:AI for analog input channel.
n:Analog channel, digital port, SCXI chassis, SCXI module number, or
AMUX-64T device number.
SC:Keyword stands for SCXI chassis.
MD:Keyword stands for SCXI module.
CH:Keyword stands for SCXI channel.
AM:Keyword stands for AMUX-64T device.
!:Delimiter.
For example, the following string specifies onboard analog input channel 5 as the trigger
channel:
AI5
The following string specifies SCXI channel 1 in SCXI module 2 of SCXI chassis 4 as the
trigger channel:
SC4!MD2!CH1
The following specifies AMUX channel 34 on the AMUX-64T device 1 as the trigger
channel:
AM1!34
You also can specify more than one channel as the trigger channel by listing all the channels
when specifying the channel number. For example, the following string specifies onboard
analog input channel 2, 4, 6, and 8 as the trigger channels:
AI2,AI4,AI6,AI8
Also, if your channel numbers ar e consecutive, you can use t he following shortcut to sp ecify
onboard analog input channels 2 through 8 as trigger channels:
AI2:8
trigLevel is the alarm limit in volts. trigLevel and deadbandWidth determin e the trigger
condition.
deadbandWidth specifies, in volts, the hysteresis window for triggering.
handle is the handle to the window you want to receive a Windows message in when
alarmOnMessage and alarmOffMessage are messages you define. When the alarm-on
condition occurs, NI-DAQ passes alarmOnMessage back to you. Similarly, when the
alarm-off condition occurs, NI-DA Q passes alarmOffMessage back to you. The messages
can be any value.
In Windows, yo u can set the message to a value including any W indo ws predef ined messages
such as
from
WM_PAINT. However, to define your own message, you can use any value ranging
WM_USER (0x400) to 0x7fff. This range is reserved by Microsoft for messages you
define.
callbackAddr is the address of the user callback function. NI-DAQ calls this function when
DAQEvent occurs. See
Using This Function
To meet the high alarm-on condition, the input signal must first go below
(trigLevel - deadbandWidth/2) volts and then go above (trigLevel + deadbandWidth/2)
volts. On the other hand, to meet the high alarm-off condition, the input signal must first go
above (trigLevel + deadbandWidth/2) volts an d then go below
(trigLevel – deadbandWidth/2) volts. See Figure 2-1 for an illustration of the high alarm
condition.
Config_DAQ_Event_Message for restrictions on this parameter.
On: high alarm on
Off: high alarm off
trigLevel +
deadbandWidth/2
trigLevel
trigLevel -
deadbandWidth/2
Figure 2-1.
on
off
Time
High Alarm Deadband
The low alarm deadband trigger condition is the opposite of the high alarm deadband
trigger condition. To meet the low alarm-on condition, the input signal must first go above
(trigLevel + deadba ndWidth/2) and then go below (trigLevel - deadbandWidth/2). On
the other hand, to meet the low alarm-off condition, the input signal must first go below
(trigLevel – deadbandWidth/2) and then go above (trigLevel + deadbandWidth/2 ).
See Figure 2-2 for an illustration of the low alarm condition.
Notifies NI-DAQ applications when the trigger channel signal meets certain criteria you
specify. NI-DAQ sends your application a message or executes a callback function that you
provide.
Parameters
Input
NameTypeDescription
deviceNumberi16assigned by configuration utility
modei16add or remove a message
chanStrSTRchannel string
trigLevelf64trigger level in volts
windowSizef64hysteresis window size in volts
triggerSlopei16trigger slope
trigSkipCountu32num ber of triggers
preTrigScansu32number of scans to skip before trigger event
postTrigScansu32number of scans after trigger event
handlei16handle
messagei16user-defined message
callbackAddru32user callback function address
Parameter Discussion
mode indicates whether to add a new alarm message or to remov e an old alarm message with
the given device.
0:Remove an existing analog trigger event.
1:Add a new analog trigger event.