05-11-2018 11:28 AM
Yo,
I was wondering if there is a way to set a timeout for a task's digital start trigger that is built into the NI API? I would like to cancel or stop a task if it does not receive a digital start trigger within 15s of the task being started. My task's digital start trigger configuration code is shown below.
_task.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + _deviceLocator.DeviceName + "/PFI1", DigitalEdgeStartTriggerEdge.Rising);
05-14-2018 11:59 AM
Hi b!tmaster,
You are going to want to set your timeout values:
Using the DAQmx Task Timeout Property in Visual Studio
This should set the amount of time you wait to acquire the samples before timing out. This should also cause the same timeout if you do not receive the specified trigger in the time you set.
05-14-2018 12:18 PM
Hey sherlockhom,
I have added the following line of code to my configuration, but no DaqException is ever thrown.
_task.Stream.Timeout = 15000;
Upon further investigation, if one looks at the description of the Timeout property on the DaqStream Class Zone NI page they will find the following piece of information...
"A write is considered complete when all of the written samples have been transferred to the task buffer. Writes do not wait until the written samples have been generated by the device."
This description suggests that this Timeout property cannot be used for what I am trying to achieve. And explains why a DaqException is not thrown for me.