User manual
Programmer’s Guide Page 46 of 66
With the function AcqrsD1_readData, use this code fragment:
AqReadParameters readParams; // Read Definitions
AqDataDescriptor dataDesc; // Returned waveform values
AqSegmentDescriptor segDesc; // Returned segment values
long channel = 1, nbrSamples = 4000000;
char waveformArray[4000000];
readParams.dataType = ReadInt8;
readParams.readMode = ReadModeStdW;
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;
memoryBank = (memoryBank+1)&0x1; // switch to other bank
AcqrsD1_configMode(instrID, 3, 0, memoryBank);
AcqrsD1_acquire(instrID); //essential!!
AcqrsD1_readData(instrID, channel, &readParams, waveformArray, &dataDesc,
&segDesc);
The returned data array contains the acquired waveforms as a contiguous array. E.g. if you configured nbrSamples =
5000, the data points „waveformArray[0…4999]‟ correspond to the first waveform, the data points
„waveformArray[5000…9999]‟ correspond to the second waveform etc.
3.11.10.2. Reading Gated Waveforms
For reading gated waveforms the actual desired gates should be set with the setup function
AcqrsD1_configSetupArray. This function should be called before AcqrsD1_acquire is invoked to acquire any
data that needs to be read using these gates. To read back the gate values, AcqrsD1_getSetupArray has to be used.
An example for the two routines is shown in the following code:
const int NbrGates = 64;
long channelNbr = 0;
long configObj = AvgGate;
long lastGate = NbrGates;
AqGateParameters gatePara[NbrGates];
for(int i=0;i<NbrGates; i++)
{
gatePara[i].GateLength = 256;
gatePara[i].GatePos = i*gatePara[i].GateLength;
}
AcqrsD1_configSetupArray(instrID, channelNbr, configObj, NbrGates,
gatePara);
The condition GateLength >= 4 is required. Both GateLength and GatePos must be multiples of 4.
You can read the gate parameters back, with this code: