08-05-2017 06:36 AM
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:
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:
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.
Solved! Go to Solution.
08-07-2017 09:45 AM
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
08-07-2017 04:58 PM
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.