interface to vb

 
Post new topic   Reply to topic    Pico Technology Forum Index -> PicoScope R6
Author Message
PCBarnett
Active User
Active User


Joined: 27 Feb 2007
Posts: 9

PostPosted: Thu Jul 05, 2007 8:41 am    Post subject: interface to vb Reply with quote

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.
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 667
Location: St Neots

PostPosted: Thu Jul 05, 2007 9:41 am    Post subject: Reply with quote

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
Back to top
PCBarnett
Active User
Active User


Joined: 27 Feb 2007
Posts: 9

PostPosted: Thu Jul 05, 2007 4:40 pm    Post subject: Reply with quote

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.
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 667
Location: St Neots

PostPosted: Mon Jul 09, 2007 12:21 pm    Post subject: Reply with quote

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
Back to top
PCBarnett
Active User
Active User


Joined: 27 Feb 2007
Posts: 9

PostPosted: Fri Sep 21, 2007 10:44 am    Post subject: Any progress Reply with quote

Is there any progress on this problem?
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 667
Location: St Neots

PostPosted: Wed Sep 26, 2007 9:33 am    Post subject: Reply with quote

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
Back to top
PCBarnett
Active User
Active User


Joined: 27 Feb 2007
Posts: 9

PostPosted: Thu Sep 27, 2007 9:52 am    Post subject: Reply with quote

It is only 7 parameters and I have sent you the code. Here it is again for your perusal.


PS5000test.zip
 Description:
Zipped file of vb express project

Download
 Filename:  PS5000test.zip
 Filesize:  56.88 KB
 Downloaded:  105 Time(s)

Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 667
Location: St Neots

PostPosted: Thu Sep 27, 2007 11:46 am    Post subject: Reply with quote

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
Back to top
PCBarnett
Active User
Active User


Joined: 27 Feb 2007
Posts: 9

PostPosted: Thu Sep 27, 2007 1:07 pm    Post subject: Reply with quote

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.



interface problem.jpg
 Description:

Download
 Filename:  interface problem.jpg
 Filesize:  61.17 KB
 Downloaded:  947 Time(s)

Back to top
markB
Site Admin
Site Admin


Joined: 27 Mar 2007
Posts: 80
Location: Cambridgeshire,UK

PostPosted: Fri Sep 28, 2007 1:43 pm    Post subject: Reply with quote

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:
    [DllImport("ps5000.dll"]
    private static extern uint ps5000GetTimebase(
       short handle,
       uint timebase,
       int noSamples,
       out int timeIntervalNanoseconds,
       short oversample,
       out int maxSamples,
       ushort segmentIndex);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> PicoScope R6
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group