Streaming mode.

Post general discussions on using our drivers to write your own software here
Post Reply
mitek
Newbie
Posts: 0
Joined: Fri Feb 20, 2015 1:18 am

Streaming mode.

Post by mitek »

Hi,

Can someone explain to me the basic concept of the streaming mode implemented by PICO?

First, I cannot understand why ps2000_run_streaming_ns() requires two sizes as parameters - max_samples and overview_buffer_size?

The second question: Do I have to call ps2000_get_streaming_last_values() repeatedly or I can sleep between calls? (The sample code doesn't sleep, just calls it in the loop).

And third: According to the doc the ps2000_get_streaming_last_values() can return 0 if there is no samples available. It doesn't make sense, because it's callback registration function, how do I know that it's time to ask for call back then?

Thanks.

Hitesh

Re: Streaming mode.

Post by Hitesh »

Hi mitek,

In streaming mode, you set the device running and then continuously collect data from the driver when it is available or wait until the device has finished collecting data and retrieve it from the driver.

To answer your questions:
First, I cannot understand why ps2000_run_streaming_ns() requires two sizes as parameters - max_samples and overview_buffer_size?
The driver stores data from each channel - this corresponds to max_samples. Once you have finished collecting data, this can be retrieved from the driver using the ps2000_get_streaming_values_no_aggregation() for raw data values or call ps2000_get_streaming_values() to obtain aggregated data.

When collecting streaming data, the driver uses a temporary buffer to store data in before passing it to your application. The overview_buffer_size parameter is used to define the size of this buffer. It is from these buffers that you copy data inside the streaming callback function.
The second question: Do I have to call ps2000_get_streaming_last_values() repeatedly or I can sleep between calls? (The sample code doesn't sleep, just calls it in the loop).
You can introduce a small sleep depending on the sampling rate at which you are collecting data. You need to ensure that you are collecting data at suitable intervals to ensure that data is not lost. Note that the PicoScope 2000 Series oscilloscopes are low memory devices so it would not take long to fill up the buffer memory which is used as a cache in streaming mode.
And third: According to the doc the ps2000_get_streaming_last_values() can return 0 if there is no samples available. It doesn't make sense, because it's callback registration function, how do I know that it's time to ask for call back then?
The function will return 0 if one of the input values is out of range. In the case of no samples being available, this would most likely be if the function is called when streaming data collection has stopped.

I hope that this helps.

Post Reply