Problems with callback function

Post your VB and VBA discussions here
Post Reply
daniel123
Newbie
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Problems with callback function

Post by daniel123 »

Hello.

I have a picoscope 3000Series and want to to measurements in fast streaming mode.

Now I have problems to implement my callback function:

1. where must i implement this function
(create a new sub or implement it in C++)
(I have already seen the example in c++)
2. How can I integrate this callback function

Can someone post callback function?

Thank you for your help.

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Post by Robin »

Hi

I'm not sure I fully understand the question.
1. where must i implement this function
(create a new sub or implement it in C++)
(I have already seen the example in c++)
2. How can I integrate this callback function
Presumably you are developing in VB, so the callback function will be part of your VB application. You can put the function anywhere you like as long as you pass a valid pointer to ps3000_get_streaming_last_values.

The driver will call your function when the data is ready.

Regards

Robin

daniel123
Newbie
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Post by daniel123 »

Hi.

Thank you for your answer. I programming the first time in VBA.
I have problems to give the function get_streming_last_values a correct pointer.

Do you have an example code (Callback function) in VBA for me?

Thank you.

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Post by Robin »

Hi

I assumed you were using VB. I don't think that VBA supports function pointers, so it's not possible to implement fast streaming.

It is possible to get around this by using a wrapper DLL.

The other option is to use normal streaming by calling ps3000_run_streaming.

What sampling rate do you need and what model of scope do you have?

Robin

daniel123
Newbie
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Post by daniel123 »

Hi,

thanks for the quick response.
At the moment I use the Pico 3423rd But I will buy the Pico 4423rd
I want to perform measurements with a frequency of about 100KS on three channels. (Duration about 100 seconds)
However, I need the high frequency for one channel. The other two channels are to be filtered by the software.
I will analyze the series of measurements directly into Ecxel.

I think that the normal streaming mode is not sufficient, since I'm going to get large data packets with 100KS ?

Is there a wrapper.dll for 3423?

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Post by Robin »

Hi

I have created a simple wrapper that will allow you to use fast streaming. I have included the source code and it is quite straightforward.

You need to create your buffers and pass them to SetDataBuffers. As with the driver, there are two buffers for each channel, min and max values. These are used for aggregation.

Once you have called run_streaming_ns, call GetStreamingLastValues and then wait until data is available by polling IsReady. Your buffers will then contain nSamples of data.

If you want to access any of the other information from the callback function, call AvailableData

Regards

Robin
Attachments
ps3000wrap.zip
(4.1 KiB) Downloaded 626 times

daniel123
Newbie
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Post by daniel123 »

Thank you very much.

Post Reply