|
|
| Author |
Message |
PCBarnett Active User

Joined: 27 Feb 2007
Posts: 9
|
Posted: Thu Jul 05, 2007 8:41 am Post subject: interface to vb |
|
|
| 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

Joined: 01 Dec 2006
Posts: 606
Location: St Neots
|
Posted: Thu Jul 05, 2007 9:41 am Post subject: |
|
|
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

Joined: 27 Feb 2007
Posts: 9
|
Posted: Thu Jul 05, 2007 4:40 pm Post subject: |
|
|
| 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

Joined: 01 Dec 2006
Posts: 606
Location: St Neots
|
Posted: Mon Jul 09, 2007 12:21 pm Post subject: |
|
|
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

Joined: 27 Feb 2007
Posts: 9
|
Posted: Fri Sep 21, 2007 10:44 am Post subject: Any progress |
|
|
| Is there any progress on this problem?
|
|
| Back to top |
|
 |
ziko Site Admin

Joined: 01 Dec 2006
Posts: 606
Location: St Neots
|
Posted: Wed Sep 26, 2007 9:33 am Post subject: |
|
|
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

Joined: 27 Feb 2007
Posts: 9
|
Posted: Thu Sep 27, 2007 9:52 am Post subject: |
|
|
It is only 7 parameters and I have sent you the code. Here it is again for your perusal.
| Description: |
| Zipped file of vb express project |
|
 Download |
| Filename: |
PS5000test.zip |
| Filesize: |
56.88 KB |
| Downloaded: |
95 Time(s) |
|
|
| Back to top |
|
 |
ziko Site Admin

Joined: 01 Dec 2006
Posts: 606
Location: St Neots
|
Posted: Thu Sep 27, 2007 11:46 am Post subject: |
|
|
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

Joined: 27 Feb 2007
Posts: 9
|
Posted: Thu Sep 27, 2007 1:07 pm Post subject: |
|
|
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.
| Description: |
|
 Download |
| Filename: |
interface problem.jpg |
| Filesize: |
61.17 KB |
| Downloaded: |
937 Time(s) |
|
|
| Back to top |
|
 |
markB Site Admin

Joined: 27 Mar 2007
Posts: 80
Location: Cambridgeshire,UK
|
Posted: Fri Sep 28, 2007 1:43 pm Post subject: |
|
|
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 |
|
 |
|