## Sample rate confusion

Post general discussions on using our drivers to write your own software here
Sonander
User
Posts: 8
Joined: Mon Jan 05, 2009 10:13 pm
Location: Letchworth, England

### Sample rate confusion

I am trying to understand how to translate the time_interval parameter returned by the get_timebase to, well, a time interval. A time interval to me means a time interval between successive samples.

Making the get_timebase call returns time_interval=20 and time_units=1 as the fastest timebase. I dont see any way of squaring that up with the 200MHz max sample rate of a 2204. Any ideas?

I tried running the PS2000_con application, and its timebase select feature prints the menu below. Curiously which ever number you pick, it then prints
Timebase n - 5242880 ns
eg the two extremes return
Timebase 0 - 5242880 ns
and
Timebase 18 - 5242880 ns
Which is an oddly consistant result.

Whats also odd is the numbers in the menu.
If 10ps was a sample rate, then thats
10 x 1e-12 between samples, ie 1e-11
That makes the sample rate 100GHz, and the Picoscope 2204 unit a real bargin!

If anyone can shed any light on this I would appreciate it.

Jeremy.

Timebase select menu from PS2000con.exe

Specify timebase
time unit: 2
0 -> 10 ps 1
time unit: 2
1 -> 20 ps 1
time unit: 2
2 -> 40 ps 1
time unit: 2
3 -> 80 ps 1
time unit: 2
4 -> 160 ps 1
time unit: 2
5 -> 320 ps 1
time unit: 2
6 -> 640 ps 1
time unit: 2
7 -> 1280 ps 1
time unit: 3
8 -> 2560 ns 2
time unit: 3
9 -> 5120 ns 2
time unit: 3
10 -> 10240 ns 2
time unit: 3
11 -> 20480 ns 2
time unit: 3
12 -> 40960 ns 2
time unit: 3
13 -> 81920 ns 2
time unit: 3
14 -> 163840 ns 2
time unit: 3
15 -> 327680 ns 2
time unit: 3
16 -> 655360 ns 2
time unit: 3
17 -> 1310720 ns 2
time unit: 4
18 -> 2621440 us 3

ziko
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

### Re: Sample rate confusion

Hi and thank you for your forum post.

Yes there is a problem there with the programming example. You must have a 2205 by the way as this product can sample at 200MS/s rather than the 2204 that samples at 100MS/s.

The problem in the programming example in the void set_timebase function. The particular function causing the problem is ps2000_get_timebase which has the wrong variable in it, below has the correct variables:

ps2000_get_timebase ( unitOpened.handle, timebase, BUFFER_SIZE, &time_interval, &time_units, oversample, &max_samples );

The problem was that the second variable, timebase, had the variable i which was 19 after going through the for loop.

I have put that as a bug report and should be fixed soon.

Kind regards
Ziko

Technical Specialist

Sonander
User
Posts: 8
Joined: Mon Jan 05, 2009 10:13 pm
Location: Letchworth, England

### Re: Sample rate confusion

That answers one part of it, specifically why the display of the selected timebase is always the same.

There are a couple of mysteries left. Like why is option 1 showing 20ps as a valid timebase? That seems about 3 orders of magnitude too fast for a 2XXX series scope.

Then look at the leap between options 7 and 8
7 -> 1280 ps 1
8 -> 2560 ns 2

Is there really nothing in between these two sample rates? They differ by 2000X.

I suspect the answer is that the ps2000_get_timebase always reports time_interval in ns. Unfortunatly is no clue in the documentation, and that leaves the purpose of the time_units parameter of ps2000_get_timebase unexplained.

ziko
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

### Re: Sample rate confusion

Hi yeah there is another problem in the programming example, please find the correct file attached. There were two extra variables that were shown and were not necessary! One of them was giving the most suitable unit for expressing sample times and the (i.e. giving best resolution without overflow) and the other was its time base number. In the attached file these two variables are and replaced the unit with ns in the printf statement.

Hope this helps.

Kind regards
Attachments
PS2000con.c