Test and Measurement Forum

interface to vb

Forum for discussing PicoScope version 6 (non-automotive version)

interface to vb

Postby PCBarnett » Thu Jul 05, 2007 8:41 am

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.
PCBarnett
Active User
Active User
 
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby ziko » Thu Jul 05, 2007 9:41 am

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
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby PCBarnett » Thu Jul 05, 2007 4:40 pm

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.
PCBarnett
Active User
Active User
 
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby ziko » Mon Jul 09, 2007 12:21 pm

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
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Any progress

Postby PCBarnett » Fri Sep 21, 2007 10:44 am

Is there any progress on this problem?
PCBarnett
Active User
Active User
 
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby ziko » Wed Sep 26, 2007 9:33 am

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
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby PCBarnett » Thu Sep 27, 2007 9:52 am

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 268 times
PCBarnett
Active User
Active User
 
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby ziko » Thu Sep 27, 2007 11:46 am

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
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby PCBarnett » Thu Sep 27, 2007 1:07 pm

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
PCBarnett
Active User
Active User
 
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby markB » Fri Sep 28, 2007 1:43 pm

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
markB
Site Admin
Site Admin
 
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK


Return to PicoScope 6 for Windows

Who is online

Users browsing this forum: No registered users and 0 guests