Test and Measurement Forum

Linux Qt frontend for Picoscope 2000/3000

Post your Linux discussions here

Linux Qt frontend for Picoscope 2000/3000

Postby vincent » Fri Mar 01, 2013 7:48 pm

Hello,

I'm writing a Linux QT application on top of library libps2_3000.

The application is available here, if you want to check out the code:

http://code.google.com/p/qpicoscope/

I have one question (I will take as example the ps3000con.c file):

When function ps3000_get_times_and_values returns I would expect that in times array between 2 consecutives values, the time elapsed would be equal to time_interval * time_units. But seems like it is not the case. Can somebody please explain me why?

Thanks in advance!
vincent
Newbie
 
Posts: 0
Joined: Fri Mar 01, 2013 9:15 am

Re: Linux Qt frontend for Picoscope 2000/3000

Postby Martyn » Mon Mar 04, 2013 7:29 am

time_units is an enumeration where the value returned tells you what units the values in the times array are
(0 - femto, 1 - pico, 2, nano,..... 5 - secs)

You should not multiply times by the value returned in time_interval.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2280
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Linux Qt frontend for Picoscope 2000/3000

Postby vincent » Mon Mar 04, 2013 9:18 am

Sorry, my question was maybe not clear enough.

I am already not using time_units as it is, but doing:

double time_multiplier = adc_multipliers(time_units);

And then after ps3000_get_times_and_values returns, trying to compute the sample times in seconds doing something like:

double time[BUFFER_SIZE] = {0};

for ( i = 0; i < no_of_samples; i++ )
{
/* get sample time in seconds */
time[i] = i * time_interval * time_multiplier;
//time[i] = times[i] * time_multiplier; /* Should be equivalent, but seems like it is not? */
}

Where times is a table of double filled by ps3000_get_times_and_values returns.

My question was why (i * time_interval * time_multiplier) != (times[i] * time_multiplier)?

Thanks in advance for your help.
vincent
Newbie
 
Posts: 0
Joined: Fri Mar 01, 2013 9:15 am

Re: Linux Qt frontend for Picoscope 2000/3000

Postby Martyn » Mon Mar 04, 2013 10:02 am

What sorts of values are you getting returned in times[] ? if you can post times[0], times[1] ..... , times[10]
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2280
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Linux Qt frontend for Picoscope 2000/3000

Postby vincent » Mon Mar 04, 2013 9:00 pm

I've made 2 traces (with 2 different time intervals).

Well times[0] is not equal to 0, that's the only difference... Well I suppose that's OK, because intervals are the same.

But maybe you can explain me where this initial value is coming from?

LOG 1 :
Code: Select all
DEBUG: timebase: 11   nb_of_samples:1024   oversample:1   time_units:2   time_interval:40960   time_multiplier:1.000000e-09   nb_of_samples_in_screen:1024
DEBUG: 1024 values, overflow 0
DEBUG: (times[0] * time_multiplier): 0.000061;   (0 * time_multiplier * time_interval): 0.000000
DEBUG: (times[1] * time_multiplier): 0.000102;   (1 * time_multiplier * time_interval): 0.000041
DEBUG: (times[2] * time_multiplier): 0.000143;   (2 * time_multiplier * time_interval): 0.000082
DEBUG: (times[3] * time_multiplier): 0.000184;   (3 * time_multiplier * time_interval): 0.000123
DEBUG: (times[4] * time_multiplier): 0.000225;   (4 * time_multiplier * time_interval): 0.000164
DEBUG: (times[5] * time_multiplier): 0.000266;   (5 * time_multiplier * time_interval): 0.000205
DEBUG: (times[6] * time_multiplier): 0.000307;   (6 * time_multiplier * time_interval): 0.000246
DEBUG: (times[7] * time_multiplier): 0.000348;   (7 * time_multiplier * time_interval): 0.000287
DEBUG: (times[8] * time_multiplier): 0.000389;   (8 * time_multiplier * time_interval): 0.000328
DEBUG: (times[9] * time_multiplier): 0.000430;   (9 * time_multiplier * time_interval): 0.000369
DEBUG: (times[10] * time_multiplier): 0.000471;   (10 * time_multiplier * time_interval): 0.000410



LOG 2 :
Code: Select all
DEBUG: timebase: 16   nb_of_samples:1024   oversample:1   time_units:2   time_interval:1310720   time_multiplier:1.000000e-09   nb_of_samples_in_screen:1024
DEBUG: 1024 values, overflow 0
DEBUG: (times[0] * time_multiplier): 0.001966;   (0 * time_multiplier * time_interval): 0.000000
DEBUG: (times[1] * time_multiplier): 0.003277;   (1 * time_multiplier * time_interval): 0.001311
DEBUG: (times[2] * time_multiplier): 0.004588;   (2 * time_multiplier * time_interval): 0.002621
DEBUG: (times[3] * time_multiplier): 0.005898;   (3 * time_multiplier * time_interval): 0.003932
DEBUG: (times[4] * time_multiplier): 0.007209;   (4 * time_multiplier * time_interval): 0.005243
DEBUG: (times[5] * time_multiplier): 0.008520;   (5 * time_multiplier * time_interval): 0.006554
DEBUG: (times[6] * time_multiplier): 0.009830;   (6 * time_multiplier * time_interval): 0.007864
DEBUG: (times[7] * time_multiplier): 0.011141;   (7 * time_multiplier * time_interval): 0.009175
DEBUG: (times[8] * time_multiplier): 0.012452;   (8 * time_multiplier * time_interval): 0.010486
DEBUG: (times[9] * time_multiplier): 0.013763;   (9 * time_multiplier * time_interval): 0.011796
vincent
Newbie
 
Posts: 0
Joined: Fri Mar 01, 2013 9:15 am

Re: Linux Qt frontend for Picoscope 2000/3000

Postby Martyn » Tue Mar 05, 2013 7:12 am

Each time is the interval between the trigger event and the corresponding sample, but as a trigger event is likely to occur between samples it is reporting exactly where between the samples this is.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2280
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to Linux

Who is online

Users browsing this forum: No registered users and 0 guests