User manual

Programmer’s Guide Page 29 of 64
3.10. Data Acquisition
Instrument operation is preceded by configuring the instrument parameters and then starting the acquisition
sequence. New settings are only loaded into the module when the acquisition is started; there is one exception to this
rule as discussed for analyzer user gate definition in section 3.5.2 Readout configuration.
Similarly, you initiate an averaging operation by configuring the instrument parameters, including those that control
the averaging, and then starting the combined acquisition/averaging sequence. The Averager module resets the
accumulation buffers and then acquires the requested number of waveforms, each preceded by a front-panel trigger
signal, without any software intervention. The AcqrsD1_acquireEx function allows an AP100/AP200 Averager to
acquire additional data without resetting the accumulation.
Until the operation is terminated, your application is free to execute other tasks. There are several methods of
detecting when the acquisition/averaging operation has ended. Finally, you read the averaged waveform with the
function AcqrsD1_readData as described below.
If you want to acquire several (averaged) waveforms under the same conditions, there is no need to call the
AcqrsXX_config… functions again. It is sufficient to execute a loop over the “start, wait, read” functions. In
principle a subsequent start will happen considerably faster than the first one that was required to load the full
configuration.
3.10.1. Starting an Acquisition
Use the following line of code for starting an acquisition in a D1-style instrument:
AcqrsD1_acquire(instrID); // start the acquisition
One such command is required for each module in use. However, if several digitizers are combined to a single
MultiInstrument with AS bus, only a single command is needed for the combined instrument.
3.10.2. Checking if Ready for Trigger
If many modules are being used it may be useful to know when they are all ready to accept a trigger. This can be
done by verifying that they are all finished with their pre-trigger phase (PreTrigger = 0) by using the call below to all
instruments (or the last instrument started):
Acqrs_getInstrumentInfo(instrID, "IsPreTriggerRunning", &PreTrigger);
3.10.3. Waiting for End of Acquisition
Usually data cannot be read from the instrument until the acquisition is terminated. The application may wait for an
acquisition to end either by polling or by waiting for interrupt.
(A) Simple Polling: use the following code fragment for polling the interrupt status:
ViBoolean done = 0;
long timeoutCounter = 100000;
while ((!done) && (--timeoutCounter > 0))
AcqrsD1_acqDone(instrID, &done); // poll for status or
if (timeoutCounter <= 0) // timeout, stop acquisition
STOP ACQUISITION
NOTE: The code above has the disadvantage of wasting CPU time while checking the instrument status during the
entire acquisition period. In addition, the timeout counter value should be set according to the expected acquisition
time, but the loop time depends on the CPU speed.