User`s manual
CYDAS UDR Library User’s Guide CYDAS UDR Library Description and Use
12
The advantage of using the two-dimensioned array is that you can directly address the data in the array by
channel. Therefore, in the example above,
DataBuffer (0, 99) addresses the 100th sample for channel 2
(channel 2 was the first element in the array;
LowChan%).
When running UDR Library for .NET, order Visual Basic arrays as
DataArray (sample, chan). The above
example would be written in UDR Library for .NET as
DataBuffer (99, 0).
String arguments
cbGetErrMsg() requires that a string variable be passed as an argument. This string variable must have been
previously allocated to be large enough to hold the longest error message. To do this, use Quick BASIC's
space$ function as it is done in the example program.
ErrStr$ = space$ (ERRSTRLEN)
Integer arguments
BASIC does not support unsigned integers (0 to 65,535). Values for the integer data type range from
–32,768 to 32,767. When using functions that require unsigned integers, the data must be converted. (Refer to
"16-bit values using a signed integer data type
" on page 7 for information on 16-bit values using unsigned
integers.)
BACKGROUND operation
If you use the
BACKGROUND option with any function, you must declare the associated data array as '$STATIC.
Unless you declare an array as
'$STATIC, BASIC may move the array around in memory as the program is
executing. Whenever you use the
BACKGROUND option, the I/O function reads/writes from the data array in the
background while the BASIC program continues executing in the "foreground.” If BASIC moves the array
while the I/O function is reading/writing to it, it will cause intermittent and unpredictable problems.
cbStopBackground() should be executed after normal termination of all background functions to clear
variables and flags.
Using the Library with VisualBasic
®
for DOS
Compiling stand-alone EXE files
Due to a quirk in VisualBasic for DOS, the following message displays if you compile a stand-alone EXE file
from within the IDE and set the EXE type to "Stand alone EXE file":
"
fixup overflow at 334 in the segment -TEXT target external 'B$CEND'".
Disregard this error message. The compiled program will run without error.
Using the Library with C for DOS
The C libraries included with the system can be used with either the Microsoft or Borland C compilers.
C header file
Every C program that uses the CYDAS UDR Library must have a line which includes the CYDAS UDR
Library C header file, CB.H. The following line should appear near the start of every program, before the first
library call is made.
#include "cb.h"