- Code: Select all
//initilize
dsMode = PS6000_RATIO_MODE_NONE;
samples = PreSamples+PostSamples;
//Determine if we are doing any downsampling
if (downRatio > 1){
dsMode = PS6000_RATIO_MODE_AVERAGE;
PreSamples = PreSamples*downRatio; //adjust samples to match down sampling ratio
PostSamples = PostSamples*downRatio;
}
//start Acquistion
err = ps6000RunBlock(ID,PreSamples,PostSamples,timebase,1,NULL,0,NULL,NULL);
if (err > 0)
goto done;
//check for completion
while (ready == 0)
{
Sleep(1); //this is a windows functions that lets other threads execute before starting again
ps6000IsReady(ID,&ready);
}
//set data buffers
err = ps6000SetDataBuffer(ID,channel,Adata,samples,dsMode);
if (err > 0)
goto done;
//Get Data
err = ps6000GetValues(ID,0,&samples,downRatio,dsMode,0,&clip);
if (err > 0)
goto done;
//This makes sure the acquisition stops. The instructions say to always call it.
err = ps6000Stop(ID);
Basically, if my variable downRatio = 1, then downsampling is disabled and everything works fine. If I set it to a value such as 2 or 4, the code runs without producing any error and it sets the value of samples after the call to ps6000GetValues, but the data buffer is not updated. I have tried also setting samples = samples*downRatio but it doesn't help. I have also tried not multiplying any of the sample numbers by downRatio, but that doesn't help. Unfortunately, the example code doesn't illustrate how to use the downsampling mode. Can you provide any guidance?
thanks, Chris
Cart

