Immediate Streaming using C#

Post your .Net discussions here
Post Reply
JackyJay
Newbie
Posts: 0
Joined: Fri Mar 01, 2019 10:33 am

Immediate Streaming using C#

Post by JackyJay » Fri Mar 01, 2019 12:18 pm

Hi everybody,

I try to get some data from my picoscope 6000 in C#. I am able to use the burst mode and to read out the data. What I would like to get is something like a "live mode". I would like to choose a sampling rate and then get all the data over time until forever (or until I click a stop button). This I would like to plot and therefore have something like a live plot mode. In principle similar to the standard Picoscope Software, only in C#. As far as I understand this could be possible with Immediate Streaming. Is that correct?

Does anybody has some experience with that and could give me some hints?

Thank you very much!

Jake

Martyn
Site Admin
Site Admin
Posts: 3714
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Immediate Streaming using C#

Post by Martyn » Fri Mar 01, 2019 12:30 pm

A good starting point would be the C# console example in particular look for the StreamDataHandler
Martyn
Technical Support Manager

JackyJay
Newbie
Posts: 0
Joined: Fri Mar 01, 2019 10:33 am

Re: Immediate Streaming using C#

Post by JackyJay » Fri Mar 01, 2019 3:09 pm

Hi Martyn,

thank you for your replay.
In principle that was the function I was looking at. But I am not quite sure, if I use it properly.
Is there a way to get a time-stamp? And as far as I see this function stops at some time. Is there a way to last it until forever?

Greetings
Jake

bennog
Advanced User
Advanced User
Posts: 59
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Immediate Streaming using C#

Post by bennog » Sun Mar 03, 2019 4:08 pm

this example will run forever unless you tell it to stop.

Benno

Martyn
Site Admin
Site Admin
Posts: 3714
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Immediate Streaming using C#

Post by Martyn » Mon Mar 04, 2019 9:00 am

There is a parameter passed to Imports.RunStreaming called autoStop which needs to be set to false (0) for streaming to be continuous.

Time stamping needs to be handled by your application, based on the sampling interval and number of samples, the scope itself has no timing.
Martyn
Technical Support Manager

JackyJay
Newbie
Posts: 0
Joined: Fri Mar 01, 2019 10:33 am

Re: Immediate Streaming using C#

Post by JackyJay » Mon Mar 04, 2019 12:17 pm

Now I got it. Thank you very much. I was a little confused, because in the Console example an _autstop variable is defined as false, but the application stops after a while.
The reason is, that the _autostop variable is not used for the RunStreaming-function:

_autoStop = false;
status = Imports.RunStreaming(_handle, ref sampleInterval, Imports.ReportedTimeUnits.MilliSeconds,
preTrigger, 1000 - preTrigger, 1, 1, Imports.PS6000DownSampleRatioMode.PS6000_RATIO_MODE_NONE, sampleCount);

So I just have to change the "1" into a "0" to get an infinite Streaming (or to use the _autostop variable).
Thank you.

Post Reply