Test and Measurement Forum

Dropout trigger for PS5203

Post your C and C++ discussions here

Dropout trigger for PS5203

Postby basti » Thu Oct 11, 2012 12:05 pm

Hi,
I'm using a Picoscope 5203 and need to implement a dropout trigger within a c++ programm.
But I'm not shure how to do this. I think it could be done with the PWQ settings but I don't know how exactly.

Is there an example available?

Cheers
Basti
basti
Newbie
 
Posts: 0
Joined: Thu Oct 11, 2012 11:48 am

Re: Dropout trigger for PS5203

Postby Hitesh » Thu Oct 11, 2012 1:12 pm

Hi Basti,

Are you looking for a level dropout or a window dropout trigger?

If it is a level dropout, you will need to use a threshold level with PWQ. The example below is a modified function from the PS3000a C console example and is for a signal that falls below a threshold and remains below that level for a period of time (you have to convert the time to a number of samples):

Code: Select all
void CollectBlockTriggered(UNIT * unit)
{
   short   triggerVoltage = mv_to_adc(1000, unit->channelSettings[PS3000A_CHANNEL_A].range, unit);
   short   triggerVoltageHys = mv_to_adc(0, unit->channelSettings[PS3000A_CHANNEL_A].range, unit); // ChannelInfo stores ADC counts

   short triggerEnabled = 0;
   short pulseWidthQualifierEnabled = 0;

   PICO_STATUS trigger_status;

   struct tPS3000ATriggerChannelProperties sourceDetails = {   triggerVoltage,
                                                triggerVoltageHys,
                                                triggerVoltage,
                                                triggerVoltageHys,
                                                PS3000A_CHANNEL_A,
                                                PS3000A_LEVEL};

   struct tPS3000ATriggerConditions conditions = {   PS3000A_CONDITION_TRUE,   //CH A
                                       PS3000A_CONDITION_DONT_CARE,
                                       PS3000A_CONDITION_DONT_CARE,
                                       PS3000A_CONDITION_DONT_CARE,
                                       PS3000A_CONDITION_DONT_CARE,
                                       PS3000A_CONDITION_DONT_CARE,
                                       PS3000A_CONDITION_TRUE};      //PWQ

   struct tPwq pulseWidth;

   struct tTriggerDirections directions = {   PS3000A_BELOW,
                                    PS3000A_NONE,
                                    PS3000A_NONE,
                                    PS3000A_NONE,
                                    PS3000A_NONE,
                                    PS3000A_NONE };

   struct tPS3000APwqConditions pwqconditions;

   memset(&pulseWidth, 0, sizeof(struct tPwq));

/* Pulse width Test Settings*/
   
   pwqconditions.channelA = PS3000A_CONDITION_TRUE;
   pwqconditions.channelB = PS3000A_CONDITION_DONT_CARE;
   pwqconditions.channelC = PS3000A_CONDITION_DONT_CARE;
   pwqconditions.channelD = PS3000A_CONDITION_DONT_CARE;
   pwqconditions.external = PS3000A_CONDITION_DONT_CARE;
   pwqconditions.aux = PS3000A_CONDITION_DONT_CARE;


   pulseWidth.conditions = &pwqconditions;
   pulseWidth.lower = 50000;      //3206B timebase 0 = 2nS * 50000 = 100uS, 16ns * 6250 = 100us
   pulseWidth.upper = 0;      
   pulseWidth.nConditions = 1;
   pulseWidth.direction = PS3000A_RISING_OR_FALLING; 
   
   pulseWidth.type = PS3000A_PW_TYPE_GREATER_THAN;

   printf("Collect block triggered...\n");
   printf("Collects when value rises past %dmV\n",

   adc_to_mv(sourceDetails.thresholdUpper, unit->channelSettings[PS3000A_CHANNEL_A].range, unit));

   printf("Press a key to start...\n");
   _getch();

   SetDefaults(unit);

   /* Trigger enabled
   * Rising edge
   * Threshold = 100mV */
   SetTrigger(unit->handle, &sourceDetails, 1, &conditions, 1, &directions, &pulseWidth, 0, 0, 0);

   trigger_status = ps3000aIsTriggerOrPulseWidthQualifierEnabled(unit->handle, &triggerEnabled, &pulseWidthQualifierEnabled);

   printf("Trigger enabled: %d, PWQ enabled: %d\n", triggerEnabled, pulseWidthQualifierEnabled);

   BlockDataHandler(unit, "Ten readings after trigger\n", 0);
}



Please also refer to the Programmer's Guide as you cannot use the same direction for the level trigger as well as the PWQ.

I hope this helps.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to C and C++

Who is online

Users browsing this forum: No registered users and 2 guests