(Hardwareversion: 16 driver version: 2, 0, 5, 7)
Annoying but not critical:
- - no code examples are installed, neither by installing picoscope 6 nor picoscope 5.20
- After some searching I manually extracted code sample files from the .cab files of ps 5.20. on the CD.
- There are NO Code samples for C#, neither on the CD nor on the website, at least I could find them. Why is this language ignored ?
Critical:
The Signal Generator is NOT working when called in C#. I wrote the necessary calls to the ps2000.dll like this:
- Code: Select all
public enum PS2000_WAVE_TYPE { PS2000_SINE, PS2000_SQUARE ,PS2000_TRIANGLE ,PS2000_RAMP_UP ,PS2000_RAMP_DOWN ,PS2000_DC_VOLTAGE};
public enum PS2000_SWEEP_TYPE {PS2000_UP,PS2000_DOWN,PS2000_UPDOWN,PS2000_DOWNUP};
...
[DllImport("PS2000.dll",EntryPoint = "ps2000_open_unit")]
public static extern short OpenUnit();
[DllImport("PS2000.dll", EntryPoint = "ps2000_set_sig_gen_built_in")]
public static extern short SetSigGen( short handle, long offsetVoltage, ulong pkToPk, PS2000_WAVE_TYPE wavetype, float startFrequency, float stopFrequency, float increment, float dwellTime, PS2000_SWEEP_TYPE sweeptype, ulong sweeps);
[DllImport("PS2000.dll", EntryPoint = "ps2000_close_unit")]
public static extern short CloseUnit(short handle);
and call it in the form like this (example with simple DC output):
- Code: Select all
short handle = 1;
handle=OpenUnit();
label1.Text = SetSigGen(handle, 1000000, 1000000,PS2000_WAVE_TYPE.PS2000_DC_VOLTAGE, 1, 1,0,0,PS2000_SWEEP_TYPE.PS2000_UPDOWN, 0).ToString();
The openunit() obviously works (device clicks and flashes), but SetSigGen() ALWAYS returns 0, which means "no errors", even if I send incorrect handles or data values (too high frequencies etc.).
Could someone please provide me with a short example how to use the built in signal generator within C# correctly ?
Hint: I noticed that the signal generator also does not work when started within picoscope 5.20 software (there its interface is rudimentary anyway...), but works fine from picoscope 6.0.
Cart


