Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected behaviour of analogue reference trigger

Solved!
Go to solution

Hi all.

I have the task that acquires data with analogue reference trigger. The task looks something like this:

task = new Task("");

task.AIChannels.CreateVoltageChannel(
                        SensorPin,
                        SensorName,
                        AITerminalConfiguration.Differential,
                        -10,
                        10,
                        AIVoltageUnits.Volts);
task.Timing.ConfigureSampleClock("", 100000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 50000);
task.Triggers.ReferenceTrigger.ConfigureAnalogEdgeTrigger( SensorName, AnalogEdgeReferenceTriggerSlope.Rising, 0.2, 10000);

Input signal have the following form:

signal.png

where

red line - trigger level (0.2),

green line - 10000 samples as presented in trigger configuration.

 

The problem is that this task works perfect when the preTriggeredSamples is about 10000 or less. But when I increase preTriggeredSamples value, the first signal's peak is missed and the second peak is triggered.

Notice that the task starts ealier and there are enough time to fill the pretriggered buffer.

 I have tried to change the buffer size - result is the same.

 

But after that I recreated this task with NI MAX:nimax_1.pngnimax_2.png

 

The task works prefectly with any value of pretriggered samples.

 

I have no idea what I am doing wrong.

Could you help me?

Thank you.

0 Kudos
Message 1 of 3
(2,343 Views)

Hi Enzy,

 

Can you clarify what you are trying to use the pretriggerSamples for? According to the .NET documentation I'm finding, any triggers before the number of pretriggerSamples hits will be ignored. This makes it sound like your .NET code is working as expected. If your trigger event occurs around 10,000 samples, then if the pretriggerSamples is set to more than this number, it will be missed.

 

Here is a link to that documentation I mentioned, specifically the "pretriggerSamples" section: http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/ce5e7870/

 

As far as why this is not occurring in NI MAX, I just want to confirm that you are using the same input signal? Any additional information that  you can provide about your goals and your system would also be helpful.

 

Thanks,

 

Andrew

0 Kudos
Message 2 of 3
(2,276 Views)
Solution
Accepted by topic author enzy

Hi, Andrew.

Thank you for reply.

Yes, the problem was the trigger event occurs around 10,000 samples. I was sure that there is enough time to fill the pretriggered buffer. But it was not true due to extended task start.

As I found today, the task with analogue reference trigger goes to Commit State over 250 ms.

And the task without this trigger - about 5 ms.

This delay is significant and unexpected for me.

Taking into account this delay I rewrote the programm and now it works fine.

 

Thanks.

0 Kudos
Message 3 of 3
(2,269 Views)