downsampling trouble

Post your C and C++ discussions here

downsampling trouble

Postby cmw32 » Thu Nov 10, 2011 8:23 pm

I have been writing a C/C++ wrapper to connect my PicoScope 6402 to my standard analysis software (Igor Pro) using Visual C++ 2010 Express. It is generally working, but I am having a lot of troubling getting the downsampling feature to work. Here is the code I am using:
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
cmw32
Newbie
 
Posts: 0
Joined: Thu Nov 10, 2011 8:09 pm

Re: downsampling trouble

Postby Hitesh » Thu Nov 17, 2011 1:21 pm

Hi Chris,

Thanks for waiting for our response.

We've been looking at a similar problem posted on the forum and found when the downsampling mode is set to PS6000_RATIO_MODE_AVERAGE, the data buffers are not being populated. If you try using PS6000_RATIO_MODE_AGGREGATE and PS6000_RATIO_MODE_DECIMATE, you should find that you get some values.

I've submitted a bug report for my colleagues to carry out further investigation.

I'll let you know when a response has been received.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 986
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: downsampling trouble

Postby aorlov » Thu Mar 01, 2012 9:28 pm

Hi,

I have similar trouble using 6403 with PS6000_RATIO_MODE_AVERAGE. Was this issue ever resolved?

thanks,
Alexei
aorlov
Newbie
 
Posts: 0
Joined: Thu Mar 01, 2012 9:20 pm


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests