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: Select all
public static extern short ps3000_get_timebase(
out int time_interval_ns,
out short time_units,
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