Test and Measurement Forum

2208 - streaming mode example doesn't work

Post your C and C++ discussions here

2208 - streaming mode example doesn't work

Postby camilzi » Mon Nov 18, 2013 1:08 pm

Hello pico-team,

I compiled c-examples provided for 2208 and unfortunatelly I get false valuse in CollectStreamingImmediate mode. The output(stream.txt) looks like:

For each of the 2 Channels, results shown are....
Maximum Aggregated value ADC Count & mV, Minimum Aggregated value ADC Count & mV

Max ADC Max mV Min ADC Min mV Max ADC Max mV Min ADC Min mV
ChA -112 = -68mV, 0 = +0mV ChB 9664 = +5944mV, 0 = +0mV
ChA 2241 = +1378mV, 0 = +0mV ChB 2242 = +1379mV, 0 = +0mV
ChA 5232 = +3218mV, 0 = +0mV ChB 5232 = +3218mV, 0 = +0mV
ChA -18596 = -11439mV, 0 = +0mV ChB -18596 = -11439mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV
ChA 0 = +0mV, 0 = +0mV ChB 0 = +0mV, 0 = +0mV

Reading block seems to worke fine and deliver correct data in block.txt

From block.txt:
Block Data log

Results shown for each of the 2 Channels are......
Maximum Aggregated value ADC Count & mV, Minimum Aggregated value ADC Count & mV

Time Ch Max ADC Max mV Min ADC Min mV Ch Max ADC Max mV Min ADC Min mV
0 ChA 19712 = +12125mV, 6016 = +3700mV ChB 0 = +0mV, 9664 = +5944mV
2 ChA 19712 = +12125mV, -18596 = -11439mV ChB 0 = +0mV, 2242 = +1379mV
4 ChA 19712 = +12125mV, 6016 = +3700mV ChB 0 = +0mV, 5232 = +3218mV
6 ChA 19712 = +12125mV, -18596 = -11439mV ChB 0 = +0mV, -18596 = -11439mV
8 ChA 19712 = +12125mV, 2272 = +1397mV ChB 0 = +0mV, 0 = +0mV
10 ChA 19712 = +12125mV, 2242 = +1379mV ChB 0 = +0mV, 0 = +0mV
12 ChA 19712 = +12125mV, 2272 = +1397mV ChB 0 = +0mV, 0 = +0mV
14 ChA 19712 = +12125mV, 2242 = +1379mV ChB 0 = +0mV, 0 = +0mV
16 ChA 19712 = +12125mV, -19200 = -11811mV ChB 0 = +0mV, 19968 = +12283mV
18 ChA 19712 = +12125mV, -19456 = -11968mV ChB 0 = +0mV, 19712 = +12125mV
20 ChA 19712 = +12125mV, -19200 = -11811mV ChB 0 = +0mV, 19968 = +12283mV

What could be the reason for this different behavior? What do I wrong? I had already tested different Settings for timestamps and voltage values.

My goal is to write an application which start 2208 in streaming mode. GnuPlot\Octave shall catch the stream and visualize it live?
Is is a good approch to use streaming mode for such application? Maybe reading a blocks would be a better solution? Could you give me a hint?

Thanks & Regards
camilzi
camilzi
Newbie
 
Posts: 0
Joined: Mon Nov 18, 2013 12:44 pm

Re: 2208 - streaming mode example doesn't work

Postby Hitesh » Mon Nov 18, 2013 3:55 pm

Hi Camilzi,

How long are you looking to capture data for and at what sampling interval?

Please ensure that you are using the example from the latest SDK (R10.5.0.28), as the streaming callback function has been updated to copy data from the driver buffer into an application buffer which you can then process.

Thanks,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: 2208 - streaming mode example doesn't work

Postby camilzi » Mon Nov 18, 2013 6:38 pm

Hello Hitesh,

What do you mean with this question?:
"How long are you looking to capture data for"
Probably you mean the sleep function in example. If yes, then it would be 100ms...
I had tesed different timebase... from 1 to 256...(1ns to 2032ns)
Yes, I am using the last SDK.

I assume the data will be downloaded from the scope in BlockDataHandler or in StreamDataHandler functions:
I am a bit confused after reading API spec:
on page 16:
6. Call ps2000aGetStreamingLatestValues to get data.
7. Process data returned to your application's function. This example is using Auto
Stop, so after the driver has received all the data points requested by the
application, it stops the device streaming.

on page 19:
- ps2000aGetStreamingLatestValues get streaming data while scope is running
- ps2000aGetValuesAsync get streaming data with callback

in StreamDataHandler-Function form example application you can find:
while (!_kbhit() && !g_autoStopped && !g_overflow)
{
/* Poll until data is received. Until then, GetStreamingLatestValues wont call the callback */
Sleep(100);
g_ready = FALSE;

status = ps2000aGetStreamingLatestValues(unit->handle, CallBackStreaming, NULL);
index ++;

I don`t understand why I still get 0... I also didn't modificate the example application, etc.
I am runnig this example on Linux...

Thanks in advance
camilzi
camilzi
Newbie
 
Posts: 0
Joined: Mon Nov 18, 2013 12:44 pm

Re: 2208 - streaming mode example doesn't work

Postby Hitesh » Mon Nov 25, 2013 12:08 pm

Hi Camilzi,

Have you downloaded the example from our Debian Repository?

http://www.picotech.com/support/topic12745.html

"How long are you looking to capture data for"


This means are you collecting data over 100 seconds, 1000 seconds etc.? Block mode is used for data acquisition into device memory before transfer to PC.

If you are using the streaming example, the StreamDataHandler function is used.

You need to set the sampling interval in the call to ps2000aRunStreaming.

On p19, the reference to ps2000aGetAsync is if you wish to collect stored data after streaming has stopped.

If you are happy to collect data as it is captured, use ps2000aGetStreamingLatestValues. Please ensure that the data is copied in the streaming callback as shown in the Windows SDK example.

I hope this helps.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2058
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