PS5204 Continuous streaming mode

Post general discussions on using our drivers to write your own software here
Post Reply
danielen
Newbie
Posts: 0
Joined: Thu May 02, 2013 5:28 pm

PS5204 Continuous streaming mode

Post by danielen »

Hello,

the programming manual and the example application are unfortunately not enough for me to understand how (if it is possible) to continuously acquire data from my Pico Scopo 5204. The "Streaming Mode" would be what suites my needs, but I haven't found a way to obtain the acquired data in real time. It looks like the only data available during an acquisition is aggregated data.

Ideally what I would like to do is to have a buffer filled with the data read by the Pico Scope in a ring buffer fashion and a callback (or other mechanism) to signal when the buffer is half full so that I can retrieve the data from the buffer.

Does this possibility exist? Can you point me to the API to do that?

Thank you. Cheers,
Daniele

Hitesh

Re: PS5204 Continuous streaming mode

Post by Hitesh »

Hi Daniele,

You can specify a down sample ratio of 1 when you call the ps5000RunStreaming function and then use the ps5000SetDataBuffer function to set up data buffers to collect data without aggregation.

Referring to section 2.6.4.1 'Using streaming mode' in the Programmer's Guide, once you start the device capturing streaming data, you need to call the ps5000GetStreamingLatestValues function in a loop. This registers a callback function with the driver which then indicates when data is ready.

You cannot specify the callback to signal when the buffer is half full but you can specify the size of the overview buffers used to temporarily store the data in the ps5000RunStreaming function.

How long do you need to capture data for and how many samples?

I hope this helps.

danielen
Newbie
Posts: 0
Joined: Thu May 02, 2013 5:28 pm

Re: PS5204 Continuous streaming mode

Post by danielen »

Hello Hitesh,

thank for your answer. At a second more thoughtful reading of the manual I independently found this same solution. I understand that this is probably not the operational mode intended for the Pico Scope hardware, but the manual can maybe made more clear on this.

The half full buffer notification was only an example, it is a common solution for other hardware interfaces and has a few practical advantages. I admit that I do not fully understand the design principle of the ps5000GetStreamingLatestValues interface. If I am supposed to call this function in a loop, why do I need a callback mechanism? I would expect the function to simply return the information that is now passed to the callback to the caller. But this is not very relevant.

My application ideally would run indefinitely collecting an unbound number of samples. The Pico Scope acquires data with a sampling rate of 1 MHz, the data is processed on the fly, resulting in a down-sampled data stream at 20 Hz, the result of the processing is stored to disk.

Cheers,
Daniele

Hitesh

Re: PS5204 Continuous streaming mode

Post by Hitesh »

Hi Daniele,

The callback is used by the driver to indicate when data is ready.

The reason for the loop is that you need to keep on extracting data from the driver otherwise it will be overwritten.

Collecting data at 1MS/s will be fine as you can specify a sampling interval of 1 microsecond, and if you set the auto_stop parameter to 0, you should be able to continously stream data. It is recommended to have some kind of loop condition so you can break out of the loop and stop the data collection.

You can choose to downsample the data using the driver if you wish.

I hope this helps.

Post Reply