From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to know if/when a StartTrigger has been received for a Task?

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?

0 Kudos
Message 1 of 4
(1,916 Views)

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!

Claire C.
AppSW Staff Product Support Engineer
National Instruments
CLD|CTD
0 Kudos
Message 2 of 4
(1,880 Views)

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?

0 Kudos
Message 3 of 4
(1,866 Views)

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.

0 Kudos
Message 4 of 4
(1,861 Views)