National Instruments PC-OPDIO-16 Telescope User Manual


 
The Fundamentals of Building Applications with NI-DAQChapter 4
PC-OPDIO-16 User Manual 4-12 © National Instruments Corporation
3. Turn on the {$N+} compiler option to enable the extended floating-point types. You can
use this option whether or not you actually have a math coprocessor; if you do not have a
coprocessor, Turbo Pascal will emulate one for you. NI-DAQ functions expect to receive
8-byte floating-point values; with the $N option enabled, Turbo Pascal for Windows can
generate an 8-byte variable of type double. Otherwise, with this option disabled, Turbo
Pascal can only generate a 6-byte real, which is not compatible with NI-DAQ routines.
To use the NI-DAQ functions, you must use the NI-DAQ DLL. You will not be using the import
library (as in C or C++) to reference the DLL, however. Follow this procedure:
1. Create your source file as you would for any other Windows program written in Pascal,
calling NI-DAQ functions as typical function calls.
2. Prototype any NI-DAQ routines used in your application. Include the NI-DAQ include file,
which prototypes all NI-DAQ routines, as shown in the following example:
{$I WDAQ_TP.INC}
Note: This include file defines a special pointer to a double type called PDouble. Use
PDouble in a manner similar to that of the Turbo Pascal for Windows type
PInteger.
Example Programs
You can find a set of example programs and the necessary header files in the
NIDAQWIN\TP_EX directory.
Special Considerations
Buffer Allocation
To allocate memory, you can use the Windows functions GlobalAlloc() and
GlobalFree() or an NI-DAQ memory management function, NI_DAQ_Mem_Alloc or
NI_DAQ_Mem_Free. After allocation, to use a buffer of memory, you must lock memory with
GlobalLock() or NI_DAQ_Mem_Lock. After using the memory, you must unlock memory
with GlobalUnlock() or NI_DAQ_Mem_Unlock.
Note: If you allocate memory from GlobalAlloc(), call GlobalLock(), and
GlobalPageLock() on the memory object before passing it to NI-DAQ.