User`s manual

CYDAS UDR Library User’s Guide CYDAS UDR Library Description and Use
11
Input arguments
Input arguments to a library function are listed in the CB.BI file definition as
BYVAL. You can pass these
arguments as either a variable or a constant. For example, both of these versions are acceptable:
BoardNum% = 0
cbStopBackground (BoardNum%)
or
cbStopBackground (0)
Output arguments
Output arguments pass information back to the calling function. For example,
cbAIn() returns the value from
an A/D to the
DataValue% argument. Others arguments are both inputs and outputs. For example, the Rate&
argument specifies the requested sampling rate for
cbAInScan() (Input).
The actual sampling rate can vary from the requested sampling rate.
cbAInScan() returns the actual rate to the
Rate& argument (output). Output and input/output arguments are defined in the CB.BI function definitions as
SEG. All SEG arguments can only be passed via a variable.
The following example is correct:
Count& = 1000
Rate& = 15000
cbAInScan (0, 0, 1, Count&, Rate&, BIP5VOLTS, DataArray(0), 0)
The following example is NOT correct:
cbAInScan (0, 0, 1, 1000, 15000, BIP5VOLTS, DataArray(0), 0)
DataArray argument with multiple channels
Some functions have a
DataArray argument. DataArray either receives the data from an input function, such
as
cbAInScan(), or contains the data to send to an output function, such as cbAOutScan().
DataArray must be dimensioned to be large enough to contain all of the data. The array can either be
dimensioned with one-dimension or two dimensions. When sampling more than one channel, it is often more
straightforward to use a two-dimensional array. The code below shows both methods:
DIM DataBuffer (1999) 'One-dimensional array. 0 to 1,999 (2,000)
elements.
or
DIM DataBuffer (1, 999) 'Two-dimensional array. 0 & 1 with 0-999
(1,000) elements each.
LowChan% = 2
HighChan% = 3
Count& = 2000
Rate& = 1000
cbAInScan (0, LowChan%, HighChan%, Count&, Rate&, BIP5VOLTS, DataBuffer(0), 0)
or
cbAInScan (0, LowChan%, HighChan%, Count&, Rate&, BIP5VOLTS, DataBuffer(0,
0), 0)