Test and Measurement Forum

Questions about Oversampling and MaxSamples 2205

Post your VB and VBA discussions here

Questions about Oversampling and MaxSamples 2205

Postby traegeaf » Thu Jan 15, 2009 12:24 am

While attempting to make use of oversamping I've become quite confused about the maximum number of samples.

while using ps2000_get_timebase(...) with a timebase of 9, and an oversampling rate of 2. I get a maxsamples value just under 4000. Now if I try to set the number of samples to the value of maxsamples it returns 0, appearing to be out of range. To get the function to return in range, I must take the value for maxsamples that the get_timebase(...) returns and divide it by the oversampling rate. Resulting in just under 2000 samples.

My problem is that I could really use a higher oversampling rate, and 2000 samples.

Is this the correct operation of get_timebase with oversampling. It appears to in a 1/(oversampling rate)^2 reduction in maxsamples.

Or is this a glitch in the dll function?

Thanks for any insite you can give.
-Adam
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Re: Questions about Oversampling and MaxSamples 2205

Postby Robin » Thu Jan 15, 2009 2:29 pm

traegeaf wrote: Now if I try to set the number of samples to the value of maxsamples it returns 0, appearing to be out of range.


Hi

Do you mean that you are calling ps2000_run_block and setting the second argument to the value of maxSamples returned by ps2000_get_timebase?

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby traegeaf » Thu Jan 15, 2009 5:15 pm

No, right now I'm strickly in the get_timebase(...) function.

If I pass it no_of_samples as 1, just to see what it returns as max_samples. It might return something like 896. If I then take that number and I re-run get timebase with no_of_samples = 896 it returns as out of range. If i then divide the 896 by the oversampling rate of 8 = 112 and I try to run get_timebase with that as no_of_samples, it still returns the 896 as the max_samples but the 112 is the largest Im able to use.
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby Robin » Mon Jan 26, 2009 4:19 pm

Hi

Sorry for the delayed response.

The get_timebase function takes oversampling in to account. So if you change over sampling from 1 to 2, max_samples should be halved.

You should be able to set no_of_samples to the value of max_samples. I have double checked this and I'm not sure why you are getting 'out of range'.

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby traegeaf » Mon Jan 26, 2009 5:20 pm

So, if I'm understanding this right. I should be able to do something like this.

Code: Select all

  no_of_samples = 2000
  oversample = 4

  ps2000_handle = ps2000_open_unit()
 
  Call ps2000_set_ets(ps2000_handle, 0, 0, 0)
  Call ps2000_set_channel(ps2000_handle, 0, 1, 1, 5)
  Call ps2000_set_channel(ps2000_handle, 1, 0, 0, 4)

 
  Call ps2000_set_trigger(ps2000_handle, 0, 8000, 1, 0, timeout_ms)

  Call ps2000_get_timebase(ps2000_handle, _
                           timebase, _
                           no_of_samples, _
                           time_interval, _
                           time_units, _
                           oversample, _
                           max_samples)



When this with a small value, like no_of_samples = 20, I get a large value for max_samples. But if i re-run the code with no_of_samples = max_samples, I get an out of range. The max I can get to return as in range is no_of_samples = max_samples/oversample.

I'm working with a 2205 with one channel disabled. So for a rough estimate, I think I should be able to get just less than 16000/oversample = max_samples. And I should be able to set no_of_samples to this value as well.

So this is a dll or driver issue then?

Thanks Adam
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby Robin » Thu Jan 29, 2009 1:43 pm

Hi

I have been trying this using the ps2000con.c example and not had the same problem.

I set no_of_samples = 2000 oversample = 4 and the function returned max_samples = 3968. I then re-ran it with no_of_samples = 3968, with no error. Are you changing anything else, such as the timebase?

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby R.M.Hox » Fri Jan 30, 2009 5:32 pm

Hi,

I'm having same kind of problem as traegeaf. I'm trying to use oversampling but get_timebase function won't accept certain values I think it should. I made a loop to test what it does accept and what it doesn't. Result are as follows:

-timebase can be anything from 0 to 23. Over 23 will allways result in error no matter what other inputs are. Following oversample/no_of_samples relation is true for all timebases between 0 and 23.

-oversample and no_of_samples are related in following way:

Code: Select all
   oversample   no_of_samples
   0            8064
   1            8064
   2            1984
   4            480
   8            112
   16           24
   32           4
   64           0
   65           none
   256          none


Where no_of_samples is the maximum number that get_timebase function will accept with given oversample. Anything under that works too. Note that with oversample over 64 the function will allways return error. With 64 it will accept zero but nothing more. Oversample 1 will give ~8000 as expected (PicoScope 2203). However in overall I expected something more like:

    8000 / oversample = no_of_samples
Former result comes with PS2000.dll versions 2.0.5.5 and 2.0.7.3. If I use version 2.0.7.2 which was posted by Robin on "Does oversampling work on 220X scopes with 64 bit Linux?"-thread, I will get following table:

Code: Select all
   oversample   no_of_samples
   0            8064
   1            8064
   2            3968
   4            1920
   8            896
   16           384
   32           128
   64           0
   65           none
   256          none


The odd part is that with PicoScope6 oversampling seems to be working. I'm able to capture signal with any "Resolution Enhance" I want and the data is "enhanced".

I'm programming in VB.NET but tried the ps2000con.c example and it too had the same limits as above.

So if someone could please tell me if this is what I should expect or how to make this oversampling work...?
R.M.Hox
User
User
 
Posts: 3
Joined: Fri Jan 30, 2009 4:48 pm

Postby traegeaf » Fri Jan 30, 2009 6:48 pm

I belive the picoscope 6 software uses fast streaming mode, and uses a oversampling in the software to provide the added resolution.. The oversampling is pretty easy to do. You take how ever many samples more than required, run them through a filter, which will cause linearization between points providing the enhanced resolution, and then decimate the data to reduce the number of data points.
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby Robin » Mon Feb 02, 2009 10:00 am

Hi

PicoScope 6 does not use the oversample function of the driver. Resolution enhancement is done by PicoScop 6 and uses a moving average filter.

We are loooking in to oversampling in the driver as it does not appear to be working correctly. I will post updated drivers ASAP.

The above table of oversample and no_of_samples looks correct to me.

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby Robin » Mon Feb 02, 2009 1:06 pm

Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby R.M.Hox » Mon Feb 02, 2009 3:01 pm

Hi,

Thanks for the quick update. However as I ran the tests for this dll (2.0.7.6), I got the exact same results as with the version 2.0.7.2.

Now what did you mean when you said that the above table looks correct? Beacause according to that table, increasing resolution 4 or even 3 bits is not possible. I am in believe that PicoSCope 2203 is capable of resolution increase of 4 bits.
R.M.Hox
User
User
 
Posts: 3
Joined: Fri Jan 30, 2009 4:48 pm

Postby Robin » Mon Feb 02, 2009 3:29 pm

Sorry, I posted the wrong version here is the correct version (2.0.7.7). I have updated the other post.

The number of samples should be (2^13 - 128) / (oversample * no. of channels).
Attachments
PS2000.zip
(340.01 KiB) Downloaded 233 times
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby R.M.Hox » Mon Feb 02, 2009 3:58 pm

Now it works as it should. Thank you!
R.M.Hox
User
User
 
Posts: 3
Joined: Fri Jan 30, 2009 4:48 pm

Postby traegeaf » Wed Feb 04, 2009 12:33 am

After testing it tonight. It works as I thought it should.

Thanks again for all the help.
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests