PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// this part looks ok to me. Just change PS4000 part to PS3000A accordingly
struct tTriggerChannelProperties sourceDetails = { triggerVoltage, triggerVoltageHys,
0,
0, PS4000_CHANNEL_A, LEVEL };
// this park could be ok too
struct tTriggerConditions conditions = {
CONDITION_TRUE, CONDITION_DONT_CARE, CONDITION_DONT_CARE, CONDITION_DONT_CARE, CONDITION_DONT_CARE, CONDITION_DONT_CARE, CONDITION_TRUE };
// change FALLING to RISING
struct tTriggerDirections directions = {
FALLING, NONE, NONE, NONE, NONE, NONE };
struct tPwqConditions pwqconditions;
// don't see any problem with this part
pwqconditions.channelA = CONDITION_TRUE;
pwqconditions.channelB = CONDITION_DONT_CARE;
pwqconditions.channelC = CONDITION_DONT_CARE;
pwqconditions.channelD = CONDITION_DONT_CARE;
pwqconditions.external = CONDITION_DONT_CARE;
pwqconditions.aux = CONDITION_DONT_CARE;
// I think this part is the most important ones to implement interval trigger. right??
pulseWidth.conditions = &pwqconditions;
pulseWidth.lower = 8; // change this number accordingly to suit my need
pulseWidth.upper = 0;
pulseWidth.type = PW_TYPE_LESS_THAN; // might need to be changed
pulseWidth.nConditions = 1;
pulseWidth.direction = RISING_LOWER;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code: Select all
/****************************************************************************
* CollectStreamingTriggered
* this function demonstrates how to collect a stream of data
* from the unit (start collecting on trigger)
***************************************************************************/
void CollectStreamingTriggered(UNIT * unit)
{
short triggerVoltage = mv_to_adc(500, unit->channelSettings[PS3000A_CHANNEL_A].range, unit); // ChannelInfo stores ADC counts
struct tPS3000ATriggerChannelProperties sourceDetails = { triggerVoltage,
256 * 10,
triggerVoltage,
256 * 10,
PS3000A_CHANNEL_A,
PS3000A_LEVEL };
struct tPS3000ATriggerConditions 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_TRUE };
struct tPS3000APwqConditions pwqconditions = { PS3000A_CONDITION_TRUE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE };
struct tTriggerDirections directions = { PS3000A_RISING,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE };
struct tPwq pulseWidth = {&pwqconditions,1,PS3000A_RISING,0,0,PS3000A_PW_TYPE_IN_RANGE};
// memset(&pulseWidth, 0, sizeof(struct tPwq));
printf("Collect streaming triggered...\n");
printf("Data is written to disk file (stream.txt)\n");
printf("Press a key to start\n");
_getch();
SetDefaults(unit);
//typedef struct tTriggerDirections
{
// PS3000A_PWQ_CONDITIONS * conditions;
// short nConditions;
// PS3000A_THRESHOLD_DIRECTION direction;
// unsigned long lower;
// unsigned long upper;
// PS3000A_PULSE_WIDTH_TYPE type;
// Play around with the values
SetTrigger(unit->handle, &sourceDetails, 1, &conditions, 1, &directions, &pulseWidth, 50, 100, 0);
StreamDataHandler(unit, 100000);
}
Code: Select all
/****************************************************************************
* CollectStreamingTriggered
* this function demonstrates how to collect a stream of data
* from the unit (start collecting on trigger)
***************************************************************************/
void CollectStreamingTriggered(UNIT * unit)
{
short triggerVoltage = mv_to_adc(1000, unit->channelSettings[PS3000A_CHANNEL_A].range, unit); // ChannelInfo stores ADC counts
struct tPS3000ATriggerChannelProperties sourceDetails = { triggerVoltage,
256 * 10,
triggerVoltage,
256 * 10,
PS3000A_CHANNEL_A,
PS3000A_LEVEL };
struct tPS3000ATriggerConditions 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_TRUE };
struct tPS3000APwqConditions pwqconditions = { PS3000A_CONDITION_TRUE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE,
PS3000A_CONDITION_DONT_CARE };
struct tTriggerDirections directions = { PS3000A_RISING,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE,
PS3000A_NONE };
struct tPwq pulseWidth = {&pwqconditions,1,PS3000A_RISING,100,200,PS3000A_PW_TYPE_IN_RANGE};
printf("Collect streaming triggered...\n");
printf("Data is written to disk file (stream.txt)\n");
printf("Press a key to start\n");
_getch();
SetDefaults(unit);
/* Trigger enabled
* Rising edge
* Threshold = 1000mV */
SetTrigger(unit->handle, &sourceDetails, 1, &conditions, 1, &directions, &pulseWidth, 0, 0, 0);
StreamDataHandler(unit, 100000);
Code: Select all
struct tPwq pulseWidth = {&pwqconditions,1,PS3000A_RISING,100,200,PS3000A_PW_TYPE_IN_RANGE};