PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
// --- Setup ---// Set level trigger on Channel A
int16_t triggerVoltage = mv_to_adc(1000, unit->channelSettings[PS3000A_CHANNEL_A].range, unit);
struct tPS3000ATriggerChannelProperties sourceDetails = { triggerVoltage, 256 * 10,triggerVoltage,256 * 10,
PS3000A_CHANNEL_A,PS3000A_LEVEL };
struct tPS3000ATriggerConditionsV2 conditions = { PS3000A_CONDITION_TRUE,PS3000A_CONDITION_DONT_CARE,PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,PS3000A_CONDITION_DONT_CARE,PS3000A_CONDITION_DONT_CARE,PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE };
struct tPwq pulseWidth;
struct tTriggerDirections directions = { PS3000A_RISING, PS3000A_NONE,PS3000A_NONE,PS3000A_NONE,PS3000A_NONE, PS3000A_NONE };
memset(&pulseWidth, 0, sizeof(struct tPwq));
// Set up Trigger
setTrigger(unit, &sourceDetails, 1, &conditions, 1, &directions, &pulseWidth, 0, 0, 0, 0, 0);
// Find the maximum number of segments
status = ps3000aGetMaxSegments(unit->handle, &maxSegments);
printf("Max. number of segments for device: %d\n", maxSegments);
// Set the number of segments (max for ps3404MSO -> 53000 segments)
nSegments = 1000;
status = ps3000aMemorySegments(unit->handle, nSegments, &nMaxSamples);
// Set the number of captures
nCaptures = 1000;
status = ps3000aSetNoOfCaptures(unit->handle, nCaptures);
// Verify timebase index is valid, sample interval will be device dependent
timebase = 2;// Set the number of captures to be retrieved per capture to 2
uint32_t nSamples = 2;
overflow = (int16_t *)calloc(unit->channelCount * nCaptures, sizeof(int16_t));
// --- Run Block ---
status = ps3000aRunBlock(unit->handle, 0, nSamples, timebase, 1, &timeIndisposed, 0, callBackBlock, NULL);
// [collecting data ..]
// --- Retrieve data ---
status = ps3000aGetValuesBulk(unit->handle, &nSamples, 0, nCaptures - 1, 1, PS3000A_RATIO_MODE_NONE, overflow);