Instruction manual
AMPDIO DRIVERS
Page 51
The function AIOgetADCpretriggerCount (see section 6.4.19.6) can be used to determine whether
the start acquisition trigger has occurred. When the start acquisition type is set to ‘START_NOW’ it
also indicates the number of samples that were acquired before the trigger occurred (a pre-trigger
count).
For the original PCI230 and PCI260 and other supported ADC cards, the only supported start
acquisition trigger source is ‘TRIG_NOW’ and the only supported start type is ‘START_NOW’. For
backward compatibility with older software, the driver resets the start acquisition trigger source to
‘TRIG_NOW’ and the start type to ‘START_NOW’ whenever a board handle is obtained using the
registerBoardEx or equivalent function.
For the PCI230+ and PCI260+, the specified start acquisition trigger is only used if the ADC FIFO
is used. It will not be used if the user interrupt is set-up with data type set to
‘ISR_READ_ADCSNOFIFO’.
3.4.3.2.2 Playing AC Analogue Signals
The same mechanism can be used to play analogue signals. In the signal generator example, the
user function copies a known pattern into a buffer. The buffer is then written to the digital to
analogue converters under driver control. By using this mechanism, it is possible to play a pattern
out on a PC24E DAC card at a sample rate of up to 25 kHz using a typical P166 machine. Note
that the rate at which the driver can produce a signal deterministically is related to machine
performance and may be impinged by other driver software loaded on to the machine.
3.4.3.3 Using Interrupts Without Callbacks
The basic user interrupt callback mechanism described in section 3.4.3.1 and the buffered user
interrupt callback mechanism described in section 3.4.3.2 both result in the creation of a thread
within the DLL which is responsible for transferring data between the driver and the callback
function. In some programming environments, this is impossible to handle. They are currently only
supported by C/C++ and Delphi bindings supplied with the driver.
Since AMPDIO v4.00, the DLL supports another mechanism for setting up buffered user interrupts
which does not involve callbacks or creation of extra threads. It allows the main thread to poll the
interface to see if data is ready (similar to the way the Event Recorder mechanism is used) or to
wait until data is ready with an optional timeout (a poll is just a wait with a timeout of 0). These
functions were originally written to support HP Vee applications, but can be used in other
programming environments.
The functions to set-up the buffered user interrupts without callbacks are
TCsetNCBufferUserInterrupt, TCsetNCBufferUserInterruptAIO and TCsetNCBufferUserInterrupt2
(see sections 6.4.15.1, 6.4.15.2 and 6.4.15.3). These are called similarly to the
TCsetBufferUserInterrupt, TCsetBufferUserInterruptAIO and TCsetBufferUserInterrupt2 functions
to set up the interrupt source, the type of data transfer, the data source or destination on the card,
the length of the buffers and whether single or double buffering is to be used (see section 3.4.3.2),
but do not have parameters for passing a callback function or a user parameter.
Once interrupts have been enabled by calling enableInterrupts, the user program can use the
TCdriveNCBufferUserInterrupt function (see section 6.4.15.4) to copy data from one of the interrupt
data buffers into a user array (when reading data from the card) or from a user array into an
interrupt data buffer (when writing data to the card). A whole buffer length of data is copied in each
case.
The TCdriveNCBufferUserInterrupt function will perform a blocking wait if necessary until it is
possible to transfer the data. It is useful to be able to poll to see whether or not the
TCdriveNCBufferUserInterrupt function will wait, so that the program can go and do something else
for a while instead. Since AMPDIO v4.02, the TCwaitNCBufferReady function (see section