National Instruments 321645c-01 Welding System User Manual


 
Chapter 1 Using the NI-DAQ Functions
NI-DAQ FRM for PC Compatibles 1-4
©
National Instruments Corporation
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 reference. For
example, you would call the
DAQ_Start
function using the following
syntax:
status% = DAQ_Start (device%, chan%, gain%, buffer%(0),
count&, timebase%, sampInterval%)