Test and Measurement Forum

Problems with callback function

Post your VB and VBA discussions here

Problems with callback function

Postby daniel123 » Tue May 04, 2010 7:41 am

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.
daniel123
Newbie
 
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Postby Robin » Tue May 04, 2010 12:10 pm

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
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Postby daniel123 » Wed May 05, 2010 7:27 am

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.
daniel123
Newbie
 
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Postby Robin » Wed May 05, 2010 9:54 am

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
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Postby daniel123 » Wed May 05, 2010 11:42 am

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?
daniel123
Newbie
 
Posts: 0
Joined: Tue May 04, 2010 6:47 am

Re: Problems with callback function

Postby Robin » Fri May 07, 2010 8:54 am

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 231 times
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Problems with callback function

Postby daniel123 » Tue May 11, 2010 7:22 am

Thank you very much.
daniel123
Newbie
 
Posts: 0
Joined: Tue May 04, 2010 6:47 am


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests