interface to vb

Forum for discussing PicoScope version 6 (non-automotive version)
Post Reply
PCBarnett
User
User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

interface to vb

Post by PCBarnett »

I have downloaded the software API's for the P5000, I am converting a VB program that ran on the PC3000 series. I have hit a snag with the interface to ps5000GetTimebase widows throws a fixup failure. Depends says I have the right number of parameters. Do you have dll library definitions for P5000 for vb yet, if not could someone tell me what it would be for the above API.

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi have you had a look at the latest documentation that includes a description of the function calls?

http://www.picotech.com/document/document.html

and look for PicoScope 5000 User Guide

Kind regards
Ziko

Technical Specialist

PCBarnett
User
User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Post by PCBarnett »

I did and successfully built vb interfaces to several API's but this one doesn't want to play ball. I was hoping one of your software guys had tested the interface and had a draft set of declarations.

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi, how many parameters are declared in ps5000GetTimebase is it 7 or 8 parameters?

If it is 8 then delete PS5000_TIME_UNITS, if you only have 7 parameters could you send your code as a post or private message.

Kind regards
Ziko

Technical Specialist

PCBarnett
User
User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Any progress

Post by PCBarnett »

Is there any progress on this problem?

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

What kind of a problem are you having? There is an error in the documentation that will be resolved in the next release. As I said before there should only be 7 parameters in the function calls, so the .chm file is correct however the .pdf has the mistake.

Kind regards
Ziko

Technical Specialist

PCBarnett
User
User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Post by PCBarnett »

It is only 7 parameters and I have sent you the code. Here it is again for your perusal.
Attachments
PS5000test.zip
Zipped file of vb express project
(56.88 KiB) Downloaded 599 times

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi I am not a programming expert, I received your file and run it and it switches the Scope on. Could you be more specific as to where the problem lies, e.g. a line of code or the specific crash?

Kind regards
Ziko

Technical Specialist

PCBarnett
User
User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Post by PCBarnett »

Here is a screen grab of the line that is failing. The pop up box which does not capture is headed

PInvokeStackImbalance was detected.

It then says
A call to PInvoke function 'PS5000test!WindowsApplication1.p5000library::ps5000GetTimebase' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

I hope this helps as its gobblyguke to me.
Attachments
interface problem.jpg
(61.17 KiB) Downloaded 984 times

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

Hi

The ps5000GetTimebase function takes 7 parameters. I'm not a too familiar with VB .Net so I've posted the following C# declaration:

Code: Select all

    [DllImport("ps5000.dll"]
    private static extern uint ps5000GetTimebase(
       short handle,
       uint timebase,
       int noSamples,
       out int timeIntervalNanoseconds,
       short oversample,
       out int maxSamples,
       ushort segmentIndex);
Regards

Mark

Post Reply