Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post your .Net discussions here
Post Reply
Scott
Newbie
Posts: 0
Joined: Wed May 16, 2012 6:45 pm

Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Scott » Wed Nov 26, 2014 9:13 pm

PicoTech,

The latest SDK for the 5000 series scopes does not include any example for VB.Net, C# or Excel. Can you provide a small code snippet the shows the correct setup for using RunBlock and IsReady?

Thanks for your time,
Scott.

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

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Martyn » Thu Nov 27, 2014 2:14 pm

Here is a simple Block Capture example for C#
Attachments
PS5000ABlockCapture.zip
Simple Block Capture
(16.37 KiB) Downloaded 173 times
Martyn
Technical Support Manager

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Hitesh » Thu Nov 27, 2014 2:43 pm

Hi Scott,

Here's VBA Excel and VB .NET examples as well.
ps5000a_ExcelVBA_VBDotNet.zip
PS5000a Excel VBA and VB .NET examples
(60.85 KiB) Downloaded 183 times
For C# and VB .NET you do not need to use the wrapper dll as you can use Delegates for the callback functions and both languages support structures.

They will be available through the next SDK release as well.

Update: Excel VBA Streaming example has been fixed.

Regards,
Last edited by Hitesh on Fri Nov 28, 2014 10:06 am, edited 1 time in total.
Reason: Updated Excel VBA Example
Hitesh

Technical Support Engineer

Scott
Newbie
Posts: 0
Joined: Wed May 16, 2012 6:45 pm

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Scott » Mon Dec 01, 2014 9:35 pm

Hello Martyn and Hitesh,

Thanks for the sample code. I got both the C# and VB.Net examples working.

I did have to assign the "index" variable in the VB.Net example that is used
for the streamwriter output.

Neither of these examples use the ps5000aWrap.dll.

The Excel example does use ps5000aWrap.dll and I have not been able to make it work.
It always fails when it first tries to use the ps5000aWrap.dll file.

Run-time error "48":
File not found: ps5000aWrap.dll

I copied PicoIpp.dll, ps5000a.dll to both the System32 and SysWOW64 directories.

I copied ps5000aWrap.dll 32 bit version (10k size) to the System32 directory and
ps5000aWrap.dll 64 bit version (11k size) to the SysWOW64 directory and it makes no
difference.

I am running Win 7 Pro 64 bit with SP1 and Microsoft Office for Home and Business 2010.

As a note, I have been through all of this for the 4000 series scopes and I can make
the Excel example for it work here as well as my custom code utilizing the ps4000wrap.dll.
I realize it is a completely separate example but it did need the same kind of manipulation.

I will explore using the delegate method with my code since it seems to be a more
integrated method but I thought you might want the feedback.

If you have any insight into why the ps5000aWrap.dll file can not be found please let me know.

Thanks for all the help,
Scott.

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Hitesh » Tue Dec 02, 2014 9:12 am

Hi Scott,

You can confirm whether your MS Excel is 32-bit or 64-bit by clicking File -> Help and view the information under 'About Microsoft Excel'.

You will also need to ensure that you have the appropriate version of the Microsoft Visual C++ 2010 Redistributable package installed for your PC:-

32-bit:

http://www.microsoft.com/en-gb/download ... px?id=5555

64-bit:

http://www.microsoft.com/en-gb/download ... x?id=14632

Please note that Pico Technology is not responsible for the content of third party sites.

Regards,
Hitesh

Technical Support Engineer

Scott
Newbie
Posts: 0
Joined: Wed May 16, 2012 6:45 pm

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Scott » Tue Dec 02, 2014 5:46 pm

Hello Hitesh,

I am running a 32 bit version of Excel and have both redistributable versions installed. I also have the
full VS2010 install including C++. There could be a conflict somewhere but the fact that the ps4000.xls
version works correctly leads me to doubt this.
I am starting to use the delegate method and it seems to be working.

Thanks again for the help,
Scott.

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Example of 5000 Series Wrapper Code for RunBlock VB.Net

Post by Hitesh » Wed Dec 03, 2014 9:10 am

Hi Scott,

You could try copying the wrapper dll to another location in your PATH environment variable.

It's better to use the C#/VB .NET examples as MS Excel does have a limit on the number of rows (just over 1 million in Excel 2010).

Regards,
Hitesh

Technical Support Engineer

Post Reply