06-14-2019 02:39 PM
Hello friends,
I am working on implementing trigger timeout for an analog output task. If no trigger is received for the task within X seconds after calling Start(), I need to stop the task. The task under discussion is configured as follows:
NiTask = new NationalInstruments.DAQmx.Task("AnalogOutputTask"); var hardwareInfo = HardwareInfo.Instance; NiTask.AOChannels.CreateVoltageChannel(hardwareInfo.AnalogOutputModuleName + "/ao0", "ao0", HardwareInfo.ChannelVoltageMinimum, HardwareInfo.ChannelVoltageMaximum, AOVoltageUnits.Volts); NiTask.AOChannels.CreateVoltageChannel(hardwareInfo.AnalogOutputModuleName + "/ao1", "ao1", HardwareInfo.ChannelVoltageMinimum, HardwareInfo.ChannelVoltageMaximum, AOVoltageUnits.Volts); NiTask.Timing.ConfigureSampleClock("", HardwareInfo.AnalogOutputSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples); NiTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + hardwareInfo.SecondDigitalIoModuleName + "/PFI0", DigitalEdgeStartTriggerEdge.Falling); NiTask.Control(TaskAction.Verify);
As you can see, I have configured the task to use a start trigger on digital input PFI0. Implementing trigger timeout would be simplified greatly if I could know or get notified when a StartTrigger is received by the task.
Is there a way to know if/when a StartTrigger has been received by a Task? If not, is there some built in trigger timeout mechanism that I could utilize?
06-17-2019 02:21 PM
Hi bitmaster,
A trigger timeout can be implemented by setting the Timeout property of the DaqStream. Documentation on this property can be found here.
Timeout Property
http://zone.ni.com/reference/en-XX/help/370473J-01/ninetdaqmxfx40ref/html/p_nationalinstruments_daqm...
Hope this helps!
06-19-2019 08:59 AM
Cullen,
The documentation states the following about the suggested Timeout property:
Gets or sets the amount of time in milliseconds to wait for reads or writes to complete.
However, I'm not interested in setting the amount of time to wait for reads/writes to complete. I am interested in knowing if a task has received a start trigger, after being started, within a certain amount of time. I don't see how this property could help me achieve my goal, what am I missing?
06-20-2019 10:32 AM
Ideally, an NI task would expose a StartTriggerReceived event or something of that nature. Unfortunately, I am pretty sure the NI API doesn't provide the information that I am looking for.
I have decided that I am going to implemented my trigger timeout detection outside of the NI API using custom hardware.