Test and Measurement Forum

PS5000A : Long Streaming acq with low sampling rate

Post your C and C++ discussions here

PS5000A : Long Streaming acq with low sampling rate

Postby Pierre_IM » Mon Jan 29, 2018 3:48 pm

Hi there,

I would like to use a PicoScope 5242B to do a long acquisition (a few hours) of a signal at a low sampling rate (around 10kHz).

My goal is to use the PicoScope to count the number of pulse (1ms duration) of a signal during a long time. I've considered using rapid block mode, but the re-arming delay (claimed to be 2ms) is too high so I may loose some pulses.

I've try to use Streaming mode instead but I cannot get it to work. I've successfully use my PicoScope for Block mode acquisition before but I do not really understand how Streaming mode works ...

What I would like to do is to launch a Streaming acquisition at 10kHz, wait 1 seconde, transfer the data using GetStreamingLatestValue on a 10 000 points buffer, count the number of pulse on the signal, then loop to use the same buffer to recover the next 10 000 points, etc.

Something that I do not understand is that the GetLastestValue fonction does not return the number of points that were actually acquired between two calls, how am I suppose the effective size of the signal returned by the function ? I do not want to use autoStop mode as I may loose some data when restarting the acquisition.

I not sure that my problem is clear but I can explain it more in details if needed !

Many thanks in advance,

Pierre
Pierre_IM
Newbie
 
Posts: 0
Joined: Tue Dec 12, 2017 10:27 am

Re: PS5000A : Long Streaming acq with low sampling rate

Postby Pierre_IM » Tue Jan 30, 2018 3:30 pm

Hi,

I somehow manage to get my software working, I figure how the GetLatestValue function work, it fills my buffer starting where it stop at last call, eventually going back to the beginning when the buffer is completely filled.

So before each call I fill my buffer with a constant value, so I get detect where my signal start and stop to extract it.

I use a 10kHz acquisition, wait 500ms before each call and my buffer is 10 000 points long, so big enough to store the complete signal at each iteration of the loop.

My problem right now is that sometimes I get a PICO_BUSY error, I do not know what causes this problem as it seems to appear randomly...

Here is my code, sorry for the bad coding, I'm not at all a developer.

https://codepaste.net/143jh6

Thanks in advance for your help !

Pierre
Pierre_IM
Newbie
 
Posts: 0
Joined: Tue Dec 12, 2017 10:27 am

Re: PS5000A : Long Streaming acq with low sampling rate

Postby Hitesh » Tue Jan 30, 2018 3:54 pm

Hi Pierre,

In streaming mode, the PicoScope will start to collect data as soon as the ps5000aRunStreaming() function has been executed.

On the first iteration of your data collection loop you could wait for one second before calling ps5000aGetStreamingLatestValues(), but you will need to ensure that the overview buffer size is large enough for the number of samples that would be collected per channel in one iteration of the loop.

The streaming callback will return the number of samples per channel (our C example shows this). We recommend copying the data into application buffers from the driver buffers in the callback.

The driver manages the process of data collection, with the number of samples returned varying depending on factors such as the size of the buffers, the time it takes for each iteration of the loop and how busy the USB bus is.

In order to process your data, you could copy the data into application buffers for each channel, monitoring total number of samples per channel and when you reach a certain number, process the data in the application buffer(s), repeating this every time you collect another 10000 samples.

Hope this helps,
Hitesh

Technical Support Engineer
Hitesh
Site Admin
Site Admin
 
Posts: 2581
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests