Test and Measurement Forum

Which mode?

Post general discussions on using our drivers to write your own software here

Which mode?

Postby ceejaytee » Sun Feb 18, 2007 6:24 pm

Hi there!
Having just purchased a Picoscope 3224 for use at work I have a question....
What is the best way to sample 300 times both channels over a 180 second period? (1.66Hz)

Currently using an ADC100 I just call:-

adc100_set_range(OutputRange,CurrentRange);
adc100_set_interval(180000000,SampleH,2);
Ok:=adc100_get_times_and_values(times,valuesa,valuesb,SampleH)>0;


I have tried different streaming modes but I have not managed to slow it down enough. What am I missing??.

I programme in Delphi and would appreciate any advice you can give.....
ceejaytee
Active User
Active User
 
Posts: 11
Joined: Sat Feb 03, 2007 10:43 am
Location: Colchester

Postby davidj » Tue Mar 20, 2007 1:06 pm

Hi
Please find the below in answer to your question.

ok = ps3000_run_streaming(ps3000_handle, 1600, 3200, TRUE);

if(ok)

{

int nSamples = 0;


while (nSamples < N_SAMPLES)

nSamples = ps3000_get_values(ps3000_handle, (short*) &values_a, NULL, NULL, NULL, NULL, N_SAMPLES);


ps3000_stop(ps3000_handle);

}


There will be a new release of software available on Monday 26th March which has a fix to a bug in the driver. Please try with the above code and the new version of software.
Regards,
David
davidj
Site Admin
Site Admin
 
Posts: 43
Joined: Wed Oct 11, 2006 8:50 am
Location: St. Neots, Cambs, UK

Postby ceejaytee » Mon Apr 02, 2007 7:08 pm

Hello
Thanks for your post with a suggestion on how to sample relatively slowly i.e. 300 samples over a 180 second period.

Firstly the statement ok = ps3000_run_streaming(ps3000_handle, 1600, 3200, TRUE); appears to be incorrect for use with DELPHI 3 or 2006.

An error is generated stating 'incompatable types boolean ~ integer'.
Reading the manual the 'TRUE' statement should be a short int.

As with the Delphi example supplied with the pico software/drivers streaming does not appear to work within the Delphi progamming language (both version 3 and 2006) on my computer.(1.5GHz Acer Laptop with 1Gb of RAM running XP Home)
Fortunately I have now managed to achieve acceptable results by 'block' sampling several times over the 180 second period and dispensing with most of the results. Not ideal........

Do you have any suggestion as to the reason I am having trouble with the streaming function?.

Obviously streaming does work because your PICO SCOPE software functions correctly under all conditions........

Thanks Chris
ceejaytee
Active User
Active User
 
Posts: 11
Joined: Sat Feb 03, 2007 10:43 am
Location: Colchester

Postby markB » Tue Apr 03, 2007 1:35 pm

Hi

davidj's example code is in C and so will not be syntactically correct for Delphi.

He also pointed out that there was a bug in streaming that would be fixed. This fix is now available in the software downloads sections (5.16.2). Does your streaming problem still occur with this latest dll?

Mark
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Postby ceejaytee » Mon Apr 16, 2007 6:40 pm

Hi
Thanks for your comments regarding streaming within Delphi.

The latest software and drivers have been installed which has now allowed the Delphi streaming example to function.
This example makes use of a windows timer function rather than the 'while' loop suggested by yourselves.
I have tried using a 'while' loop within my own code rather than a timer, such as,

ps3000_run_streaming ( ps3000_handle, 1600, 3200, 0 );

while nsamples <> max_values do
begin
nsamples := ps3000_get_values( ps3000_handle, values_a, values_b, values_c, values_d, overflow, max_values );
end;


but I have found that it just appears to lock itself into a never ending loop waiting for 'nsamples' to increment up to the max_values figure i.e. 112 samples in 180 seconds.

This it never appears to achieve.

Refering to your code suggestion, can you tell me if 'nsamples' is an actual returned value from the 'ps3000_get_values' driver function and thus correct in thinking that it should increment up after each sample is taken?.

Thanks Chris
ceejaytee
Active User
Active User
 
Posts: 11
Joined: Sat Feb 03, 2007 10:43 am
Location: Colchester

Postby markB » Tue Apr 17, 2007 6:51 am

nSamples is the numer of samples return from the call to 'ps3000_get_values.'
If you are streaming in Windowed mode, as out example is, nSamples does increment up to the window size.
If you are not in windowed mode only new samples are returned and so nSamples doesnt increment in this way.
Regards

Mark
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Postby ceejaytee » Sun Apr 22, 2007 8:18 am

Hi
Just to let you know, the streaming problem appears to be solved. A little trial and error but all works now.

Many thanks Chris......
ceejaytee
Active User
Active User
 
Posts: 11
Joined: Sat Feb 03, 2007 10:43 am
Location: Colchester


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 2 guests