User manual
Programmer’s Guide Page 47 of 66
const int NbrGates = 64;
long channelNbr = 0;
long configObj = AvgGate;
long lastGate;
AqGateParameters gatePara[NbrGates];
AcqrsD1_getSetupArray (instrID, channelNbr, configObj, NbrGates,
gatePara, &lastGate);
Make sure to use a pointer to the last argument, since it returns the number of gates. lastGate cannot exceed the
number of gates being written.
To read the gated waveforms, use the function AcqrsD1_readData.
AqReadParameters readParams; // Read Definitions
AqDataDescriptor dataDesc; // Returned waveform values
AqSegmentDescriptor segDesc; // Returned segment values
long channel = 1, nbrSamples = 20000;
char waveformArray[20000];
readParams.dataType = ReadInt8;
readParams.readMode = ReadModeGateW;
readParams.nbrSegments = 1;
readParams.firstSampleInSeg = 0;
readParams.segmentOffset = nbrSamples;
readParams.firstSegment = 0; // Read first segment
readParams.nbrSamplesInSeg = nbrSamples;
readParams.dataArraySize = sizeof(waveformArray);
readParams.segDescArraySize = sizeof(segDesc);
readParams.flags = 0;
readParams.reserved = 0;
readParams.reserved2 = 0.0;
readParams.reserved3 = 0.0;
AcqrsD1_readData(instrID, channel, &readParams, waveformArray, &dataDesc,
&segDesc);
The returned data array contains the acquired waveforms as a contiguous array of dataDesc–
>returnedSamples bytes.
Note: Make sure that the waveformArray is large enough to hold the sum of all GateLength’s times the nbrSegments.
As a rule, the waveformArray has to have as a minimum size the sum of all the gate sizes times nbrSegments (
waveformArray > ( GateLength)* nbrSegments ) .
Note: If, for each gate, the sum (GatePos + GateLength) exceeds the nbrSamplesInSeg, GatePos is reduced to
satisfy (GatePos + GateLength) <= nbrSamplesInSeg. If this is not sufficient, GateLength is shortened to satisfy that
condition.
3.11.10.3. Data Processing before Readout
In buffered mode. the AP101 offers the capability of processing the acquired data before readout. This operation
must be explicitly requested by the application, after the data acquisition has terminated.
Depending on the processing algorithms used, you may have to prepare the data processing by setting the appropriate
parameters with the function AcqrsD1_configSetupArray.
In the „peak-detect‟ mode, the AP101 will return for each gate exactly 2 peaks, first the positive and then the
negative one (some of which might be marked as „invalid‟ if no valid peak exists!). Thus, you should define the gates
in the same way as described in the previous section.
A typical acquisition/processing/readout sequence in autoswitch buffered mode would be: