Test and Measurement Forum

Advanced Triggering Issues

Post general discussions on using our drivers to write your own software here

Advanced Triggering Issues

Postby ant » Mon Apr 16, 2012 11:46 am

I am trying to configure my 2205 scope with an advanced pulse width trigger using fast streaming mode...

I am trying to trigger when I see a positive pulse that is longer than 26us. The signal goes from 1V ("low")to 2.5V ("high") so I have configured my threshold to be 1.8V.

Looking at the code that I have attached below, can anyone see any problems with how this is implemented?
I know that my implementation of fast streaming is working correctly since I actually receive samples, I just never get any indication that the scope has triggered.

Any advice would be greatly appreciated.

Regards,
Anthony

Code: Select all

void GetOverviewBuffers (short **overviewBuffers,short overflow,unsigned long triggeredAt,short triggered,short auto_stop,unsigned long nValues)
{
   if(triggered != 0)
   {
      std::wcout << "Triggered! " << nValues << std::endl;
   }
}

...

if(ps2000_set_channel(_scopeHnd,PS2000_CHANNEL_A,true,true, PS2000_5V) == 0)
   {
      std::wcout << "Failed to initialise channel A" << std::endl;
      return;
   }

   tPS2000TriggerConditions tConditions;
   tPS2000PwqConditions pwConditions;
   tPS2000TriggerChannelProperties tchProperties;

   tConditions.channelA = PS2000_CONDITION_DONT_CARE;
   tConditions.channelB = PS2000_CONDITION_DONT_CARE;
   tConditions.channelC = PS2000_CONDITION_DONT_CARE;
   tConditions.channelD = PS2000_CONDITION_DONT_CARE;
   tConditions.external = PS2000_CONDITION_DONT_CARE;
   tConditions.pulseWidthQualifier = PS2000_CONDITION_TRUE;
   
   pwConditions.channelA = PS2000_CONDITION_TRUE;
   pwConditions.channelB = PS2000_CONDITION_DONT_CARE;
   pwConditions.channelC = PS2000_CONDITION_DONT_CARE;
   pwConditions.channelD = PS2000_CONDITION_DONT_CARE;
   pwConditions.external = PS2000_CONDITION_DONT_CARE;

   tchProperties.hysteresis = 200;
   tchProperties.channel = PS2000_CHANNEL_A;
   tchProperties.thresholdMode = PS2000_LEVEL;
   tchProperties.thresholdMajor = 11794; // 1.8V
   tchProperties.thresholdMinor = 0;

   if(ps2000SetAdvTriggerChannelConditions(_scopeHnd,&tConditions,1) == 0)
   {
      std::wcout << "Failed to configure AdvTriggerChannelConditions" << std::endl;
      return;
   }

   if(ps2000SetAdvTriggerChannelDirections(_scopeHnd, enPS2000ThresholdDirection::PS2000_ADV_FALLING,PS2000_ADV_NONE,PS2000_ADV_NONE,PS2000_ADV_NONE,PS2000_ADV_NONE) == 0)
   {
      std::wcout << "Failed to configure trigger channel directions" << std::endl;
      return;
   }

   if(ps2000SetPulseWidthQualifier(_scopeHnd,&pwConditions,1, enPS2000ThresholdDirection::PS2000_ADV_FALLING ,26,0, PS2000_PW_TYPE_GREATER_THAN) == 0)
   {
      std::wcout << "Failed to configure pulse width qualifier" << std::endl;
      return;
   }

   if(ps2000_run_streaming_ns(_scopeHnd,1, PS2000_US,1000000,0,1,SCOPE_BUFFER_SIZE) == 0)
   {
      std::wcout << "Failed to start streaming" << std::endl;
      return;
   }
ant
Newbie
 
Posts: 0
Joined: Mon Apr 16, 2012 11:36 am

Re: Advanced Triggering Issues

Postby ant » Mon Apr 16, 2012 12:03 pm

I should add that Picoscope 6 correctly triggers with the settings that I detailed at the start of my post, I'm just not 100% sure how to translate that in to API calls.
ant
Newbie
 
Posts: 0
Joined: Mon Apr 16, 2012 11:36 am

Re: Advanced Triggering Issues

Postby Martyn » Mon Apr 16, 2012 12:06 pm

You will need to include Channel A in the trigger conditions, and trigger direction, so you detect the rising edge and then the width.

Code: Select all
tConditions.channelA = PS2000_CONDITION_TRUE;
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Advanced Triggering Issues

Postby ant » Mon Apr 16, 2012 1:42 pm

Hi Martyn,
Thanks for your advice, I had originally got the triggering set up like that but I'd removed it in my experimentation.
I've just put the line back and I'm still not seeing a trigger.

Can you see any issues with the rest of the configuration?

Thanks
ant
Newbie
 
Posts: 0
Joined: Mon Apr 16, 2012 11:36 am

Re: Advanced Triggering Issues

Postby ant » Mon Apr 16, 2012 4:31 pm

I'm not sure if the forum ate my post - I replied back to say that I had previously tried enabling channel A as well as the pulse width qualifier. I had just disabled it while I've been experimenting!

Do the rest of the configuration options look sensible?

Thanks
ant
Newbie
 
Posts: 0
Joined: Mon Apr 16, 2012 11:36 am

Re: Advanced Triggering Issues

Postby Martyn » Tue Apr 17, 2012 7:47 am

I haven't specifically tried this with a 2000 so am picking bits from a c# 4000 example.

For a positive pulse both the channel and pwq directions need to be PS2000_ADV_RISING not PS2000_ADV_FALLING.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 1 guest