|
|
| Author |
Message |
ceejaytee Advanced User

Joined: 03 Feb 2007
Posts: 11
Location: Colchester
|
Posted: Sun Feb 18, 2007 6:24 pm Post subject: Which mode? |
|
|
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..... |
|
| Back to top |
|
 |
davidj Site Admin

Joined: 11 Oct 2006
Posts: 67
Location: St. Neots, Cambs, UK
|
Posted: Tue Mar 20, 2007 1:06 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
ceejaytee Advanced User

Joined: 03 Feb 2007
Posts: 11
Location: Colchester
|
Posted: Mon Apr 02, 2007 7:08 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
markB Site Admin

Joined: 27 Mar 2007
Posts: 80
Location: Cambridgeshire,UK
|
Posted: Tue Apr 03, 2007 1:35 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
ceejaytee Advanced User

Joined: 03 Feb 2007
Posts: 11
Location: Colchester
|
Posted: Mon Apr 16, 2007 6:40 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
markB Site Admin

Joined: 27 Mar 2007
Posts: 80
Location: Cambridgeshire,UK
|
Posted: Tue Apr 17, 2007 6:51 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
ceejaytee Advanced User

Joined: 03 Feb 2007
Posts: 11
Location: Colchester
|
Posted: Sun Apr 22, 2007 8:18 am Post subject: |
|
|
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...... |
|
| Back to top |
|
 |
|