User manual

Programmer’s Guide Page 26 of 66
AcqrsD1_getAvgConfig(instrID, channelNbr, "TrigResync", &reSync);
AcqrsD1_configAvgConfig(instrID, channelNbr, "TrigResync", &freeRun);
AcqrsD1_acquire(instrID);
long timeOut = 1000; // depends on conditions!
AcqrsD1_waitForEndOfAcquisition(instrID, timeOut);
long nbrPoints = ???; // Should be the „current‟ number of points!
long timeStampLo, timeStampHi, nbrReturnedSamples;
double horPos, sampTime;
// Read the Waveform directly to the Background buffer
double bckGndWform[nbrPoints];
AcqrsD1_readRealWform(instrID, 1, 0, 0, nbrPoints, bckGndWform,
&nbrReturnedSamples, &horPos, &sampTime, &timeStampLo, &timeStampHi);
// Restore the settings of the averager
AcqrsD1_configVertical(instrID, 1, fsr, offset, coupl, bwidth);
AcqrsD1_configAvgConfig(instrID, channelNbr, "TrigResync", &reSync);
Use the following code fragment to acquire a „fixed pattern‟ background, assuming that the external trigger can be
used and is already set:
const long channelNbr = 0;
double fsr, offset;
long coupl, bwidth, reSync, freeRun = 2;
AcqrsD1_acquire(instrID);
long timeOut = 1000; // depends on conditions!
AcqrsD1_waitForEndOfAcquisition(instrID, timeOut);
long nbrPoints = ???; // Should be the „current‟ number of points!
long timeStampLo, timeStampHi, nbrReturnedSamples;
double horPos, sampTime;
// Read the Waveform directly to the Background buffer
double bckGndWform[nbrPoints];
AcqrsD1_readRealWform(instrID, 1, 0, 0, nbrPoints, bckGndWform,
&nbrReturnedSamples, &horPos, &sampTime, &timeStampLo, &timeStampHi);
The examples above assume that the background and the averaged waveforms are read in Volts. In this case, the
background data points are simply subtracted from the averaged waveform.
However, if you read the background and the averaged waveforms as 32-bit sums, with the function
long bckGndWform[nbrPoints]; // Background as 32-bit sum
AcqrsD1_readData(instrID, channel, &readParams, waveformArray, &wfDesc,
&segDesc);
you must correct the average as follows:
corrWform[i] = waveformArray[i] - bckGndWform[i] + 128*nbrAvgWforms;
The last term corrects for the fact that the 32-bit data are unipolar and that for display purposes the corrected
waveform should be in the middle of the vertical range if the averaged waveform is the same as the background.