National Instruments PC-OPDIO-16 Telescope User Manual


 
Chapter 4 The Fundamentals of Building Applications with NI-DAQ
© National Instruments Corporation 4-3 PC-OPDIO-16 User Manual
2. NI-DAQ library needs to allocate some memory for internal use. Therefore, you need to set
aside memory using the SETMEM statement. The amount of memory you need will depend
on which NI-DAQ functions you are using. If you have not set aside sufficient memory,
NI-DAQ functions will return a memory error (error code -98). For a description of the
SETMEM statement, refer to your BASIC manual. In the NI-DAQ Basic example programs,
a number between -2,000 and -10,000 is generally used as follows:
heap.size=SETMEM (-8000)
3. Follow the instructions in this chapter when making calls to the NI-DAQ functions.
Remember to substitute a period (.) wherever you see an underscore (_) in a function name.
For example, the function AO_Configure should be entered as AO.Configure in Visual
Basic applications.
Note: You must call the USE function in your application before calling any other
NI-DAQ functions. This function causes portions of the NI-DAQ library that
are required to use your DAQ product to be included in your application. If you
do not call the appropriate USE function, your other NI-DAQ functions will
return error -421 (functionNotLinkedErr).
Next, you can use either of the following approaches to run your application:
1. Run your application inside the Visual Basic environment. To do so, you must first create
and then load a Quick library of NI-DAQ functions when you enter Visual Basic
environment. The only case in which this approach will not work is when Visual Basic
returns out-of-memory error; in that case, use the second approach.
Note: Visual Basic returns an out-of-memory error either when you try to load the Quick
library or when you try to run your application. You may try to free up memory by
removing as many TSRs or device drivers as possible before entering the Visual
BasicC environment.
2. Compile and run your application from the DOS prompt. To do so, you use the BASIC
command-line compiler and linker.
These approaches are explained in detail in the following sections.