C# code for fast streaming?

Post your .Net discussions here
Post Reply
RodneyRichardson
Active User
Active User
Posts: 12
Joined: Wed Jul 23, 2008 5:24 pm

C# code for fast streaming?

Post by RodneyRichardson »

I am trying to use fast streaming on a PicoScope 3424, but am having problems interpreting the data being passed in the callback function.

My signature for the callback (passed into ps3000_get_streaming_last_values) looks like this:

Code: Select all

public void MyCallback(IntPtr overviewBuffers, short overflow,
   uint triggeredAt, short triggered, short auto_stop, uint nValues)
Now, the overviewBuffers should contain a 2-dimensional array of shorts (ie. short[][]), but I don't seem to be able to unmarshall it.

Any help would be appreciated.

Also, is there any progress on a C# sample?

RodneyRichardson
Active User
Active User
Posts: 12
Joined: Wed Jul 23, 2008 5:24 pm

I think I have it...

Post by RodneyRichardson »

I am capturing data from all 4 channels, at a scale of 10V, so I tried the following code, and it seems to work:

Code: Select all

public void MyCallbackIntPtr overviewBuffers, short overflow, uint triggeredAt, short triggered, short auto_stop, uint nValues)
{
    IntPtr[] buffers = new IntPtr[8];
    Marshal.Copy(overviewBuffers, buffers, 0, 8);

    short[] values = new short[nValues];
    for (int j = 0; j < 8; j++)
    {
        Marshal.Copy(buffers[j], values, 0, (int)nValues);
        for (uint i = 0; i < nValues; i++)
        {
            short myValue = values[i]/32767f) * 10f);
        }
    }
}

Seyi
Newbie
Posts: 1
Joined: Wed Sep 23, 2009 2:17 pm
Location: nigeria
Contact:

Re: C# code for fast streaming?

Post by Seyi »

how can i use usbadc11.dll in c#?
programming

Post Reply