|
|
| Author |
Message |
Guest
|
Posted: Tue Jul 19, 2005 5:19 pm Post subject: urgent help on ps3000_get_timebase called in C# |
|
|
Hi,
I need some help on calling the ps3000_get_timebase driver function in a C# application. The function call returns 0 and I can't figure out what is wrong.
[DllImport("PS3000", EntryPoint="ps3000_get_timebase")]
public static extern short ps3000_get_timebase( short handle,
short timebase, long no_of_samples, ref long time_interval_ns,
ref short time_units, short oversample, ref long max_samples );
Any suggestion is much appreciated!
Thanks in advance. |
|
| Back to top |
|
 |
Sarah Guest
|
Posted: Tue Jul 26, 2005 1:13 pm Post subject: |
|
|
Hi
Thank you for your post.
The code you gave looks basically correct apart from a minor variable length issue that I suspect will have been marshalled automatically anyway.
Here is the version that I use:
| Code: |
[DllImport("PS3000.dll")]
public static extern short ps3000_get_timebase(
short handle,
short timebase,
int no_of_samples,
out int time_interval_ns,
out short time_units,
short oversample,
out int max_samples);
|
Remember that long is usually 32 bit in C/C++ but is always 64 bit in C#, so I tend to use int instead, which is 32 bit in C#. Also I use out instead of ref to more explicitly declare the intention of the pointer parameters.
Try the version above just in case this solves the problem quickly; however, I suspect the problem is more likely to be associated with the numbers being given as arguments and the function call sequence.
The obvious first thing to verify is that the handle returned from ps3000_open_unit is valid (should be > 0). With that out of the way, turn a channel on (at least one channel must be active first) with ps3000_set_channel and then, attempt some known working values e.g. -
timebase = 4
no_of_samples = 2000
oversample = 1
Let me know how you get along with this
Best Regards |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|