OK I get an error when I try to start sampling, something to do with paths I am sure, but I can open the 'scope it's relays click. Thank you very much.
So I put the ps2000 dll in c:\ as this is where the code says it looks for it, all well so far. The 'fast' button works, i.e. I get a few readings but when I use the stert streaming button this error happens
FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the error was at 0x66f6e0e5, on thread 0x2fc. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
On this line...
mv_a = voltage_range(cboVoltageA.SelectedIndex)
oddly if I comment out the end and make mv_a = 0 thus
mv_a = 0 'voltage_range(cboVoltageA.SelectedIndex)
it still happens.
I want to use the signal generator so I have added
Declare Function ps2000_set_sig_gen_built_in Lib "c:\ps2000.dll" (ByVal handle As Short, ByVal offsetVoltage As Long, ByVal pkToPk As ULong, ByVal waveType As PS2000_WAVE_TYPE, ByVal startFrequency As Single, ByVal stopFrequency As Single, ByVal increment As Single, ByVal dwellTime As Single, ByVal sweepType As PS2000_SWEEP_TYPE, ByVal sweeps As Long) As Short
Is there a reference or something to PS2000_WAVE_TYPE and PS2000_SWEEP_TYPE. Or will I have to declare these manualy, if so what type are they?
Hi, sry that i can help by myself...but please can someone convert this example to c#.
A have something like that>
ps2000_handle = OpenUnit();
if (ps2000_handle > 0)
{
SetChannel(ps2000_handle, 0, 1, 1, ;
int timex=0;
short timey=0;
int maxsample=0;
short timebase=GetTimebase(ps2000_handle, 0, 1, ref timex, ref timey, 1, ref maxsample);
int timeindiposed=0;
RunBlock(ps2000_handle, timex, timebase, 1, ref timeindiposed);
while (Ready(ps2000_handle) < 0)
{
System.Threading.Thread.Sleep(10);
}
short[] chanelA = new short[20000];
short chanelB = 0;
short chanelC = 0;
short chanelD = 0;
short overflow = 0;
GetValues(ps2000_handle, ref chanelA, ref chanelB, ref chanelC,ref chanelD, out overflow, timex);
MessageBox.Show("ps2000 opened");
}
else
{
MessageBox.Show("Unable to open");
}
But i cannog get values, in this example i think is used arrays of short variables, but i didnt see it declared in ps2000.dll , so how i have to do:((