Test and Measurement Forum

Triggering Issues (5444B)

Post your .Net discussions here

Triggering Issues (5444B)

Postby Sigge83 » Tue Dec 01, 2015 10:18 am

Hello,
My code looks like this:

Imports.SetSimpleTrigger (handle, 1, Imports.Channel.ChannelA, 1000, Imports.Threshold Direction.Rising, 0, 0);

Imports.RunStreaming (handle, 25, Imports.ReportedTimeUnits.MicroSeconds, 0, 4000, 1, 1, Imports.RatioMode.None, (uint) sample count);

Imports.GetStreamingLatestValues(handle, StreamingCallback, IntPtr.Zero);


Which I thought would result in that samples would only be added to the buffer from and after that a the trigger-Threshold had been reached. Thus no pretriggering samples, and in my callback function the StartIndex = triggerAt = 0.
But that does not seem to be the case. Why is that? I thought that if the maxPreTriggerSamples argument was set to 0 in RunStreaming() That no pre-triggering samples would be added to the buffer.

This is not really a problem for me because it can be corrected it in the code. I just wonder why it is not as I imagined it to be:)

Something that is a bigger problem for me is the following. In my callback function I print some values for debugging. The code looks like this:


if (_sampleCount != 0 )
{
Array.Copy(buffers[0], _startIndex, appBuffers[0], _startIndex, _sampleCount);
Console.WriteLine(" noofSamples:" + noOfSamples + " TriggeredAt" + triggerAt + " StartIndex:" + startIndex +" Triggered:"+triggered);
}


And I have noticed that I occasionally get this output:

noofSamples:504 TriggeredAt0 StartIndex:0 Triggered:0
noofSamples:1008 TriggeredAt118 StartIndex:504 Triggered:1
noofSamples:504 TriggeredAt0 StartIndex:1512 Triggered:0
noofSamples:1008 TriggeredAt0 StartIndex:2016 Triggered:0
noofSamples:970 TriggeredAt0 StartIndex:3024 Triggered:0
noofSamples:628 TriggeredAt0 StartIndex:3994 Triggered:0


Edit by Admin: Changed text colour to make it readable :D

On the first line it states that it has collected 504 samples but without being triggered?? Can anyone explain that?

Best regards
S
Sigge83
Newbie
 
Posts: 0
Joined: Tue Dec 01, 2015 9:10 am

Re: Triggering Issues (5444B)

Postby Hitesh » Tue Dec 01, 2015 10:33 am

Hi S,

In streaming mode, data collection begins as soon as you call, in this case, the ps5000aRunStreaming function.As a result you will get pre-trigger values.

If you have set a trigger and set the autoStop flag, then the device will stop data collection after collecting the required number of post-trigger samples and you can discard the pre-trigger samples.

Regards,
Hitesh

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

Re: Triggering Issues (5444B)

Postby Sigge83 » Tue Dec 01, 2015 11:37 am

Thanks for the explanation and for the quick reply!

I hope it's okay that I ask one more thing regarding the triggering in streaming mode.

Just like I wrote in the previous post I'll setup my triggering like this:

Imports.SetSimpleTrigger(handle, 1, Imports.Channel.ChannelA, 10000, Imports.ThresholdDirection.Rising, 0, 0);

So I want the triggering to occur on the rising edge. But when I use a 50 Hz sine wave on ChannelA it sometimes trigger at the right level, but on the falling edge. Do you have any idea why it is doing that?


Best regards
S
Sigge83
Newbie
 
Posts: 0
Joined: Tue Dec 01, 2015 9:10 am

Re: Triggering Issues (5444B)

Postby Hitesh » Tue Dec 01, 2015 2:42 pm

Hi S,

This might be due to noise on the waveform resulting in a rising 'edge' that passes through the threshold on the falling part of the sine wave.

You may wish to use the Advanced Trigger functions and use hysteresis to account for this. The article on Advanced Digital Triggers should be of use - please take a look at the section entitled 'Advanced Edge trigger'.

Hope this helps,
Hitesh

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


Return to .Net Languages (C#, VB.Net, .)

Who is online

Users browsing this forum: No registered users and 0 guests