The first parameter to openUnit should be a pointer TO the location where you want to save the handle.
the handle is the identifier to the picoscope you are using for all your calls.
therefore your code should look like something like this
- Code: Select all
int16_t handle = 0;
r = ps6000OpenUnit(&handle, NULL);
// check r for any errors
// do things
r = ps6000CloseUnit(handle);
notice how you pass the address to handle.
You should also observe that the value of handle has changed to be non-zero.
You need to use handle in all subsequent ps6000 calls.
You were passing it the value of 0, a NULL pointer effectively. That address is invalid memory. The picoscope driver will either made a special check for that value, or it might just fail with a segfault. People typically check for the NULL pointer when taking in optional arguments, but handle is really necessary in this specific function so I can't speak about the specifics.