01-09-2017 11:21 PM
I am using a USB-6351 with MeasurementStudio 2013 running on Windows7. I am generating a pulse train
on ctr0 and using PFI0 as a pause trigger. Everything works fine. When the digital input goes high the pulse train stops. If I clear the digital input the pulse trains resumes as expected.
I am trying to figure out how to get an event when the trigger occurs so i can stop and dispose of the pulse train task. As near as I can determine DigitalChangeDetection events are not supported on this device and the Done event does not occur on pause.
I found an example where they were using a timer to check for IsDone but I could not make that work with a pause trigger.
Suggestions?
Solved! Go to Solution.
01-10-2017 03:43 PM
Here is a list of all of the text based NI-DAQmx example programs. There is a Counter Digital Events - Pause Trigger that may be helpful.
http://www.ni.com/example/6999/en/
01-10-2017 06:24 PM
Unfortunately no. I am already using a hardward trigger (digital input going high) to pause the pulse generation. I am needing a software event to let me know when the pulse generation pauses. The syntax is confusing. The digital input going high is an "event" that pauses pulse generation. I need something similar to the "IsDone" software event that gets sent to an event handler when the pulse generation first pauses.
01-11-2017 04:18 PM
DigitalChangeDetection should do what you want, and your device does support it. I have included a link to a tutorial on it, as well as the manual page and another helpful page on events and callbacks.
http://www.ni.com/tutorial/4102/en/
http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/bf8f7d1e/
http://zone.ni.com/reference/en-XX/help/370473H-01/mstudiowebhelp/html/eventscallbacksthreadsafety/
01-17-2017 07:57 PM
Pulse genration is an output task. The digital pause is a digital input. I have been trying without success to find a way to associate a digital change event with the pause digital input of the pulse generation task.
As a kludge I have setup another timer to use the pause event as a timing source. This approach was mentioned in another exchange on this message board.
Here's my code
leftLimitCheck = new Task();
leftLimitCheck.CIChannels.CreateCountEdgesChannel("/Dev1/ctr1", "checkLeft", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);
leftLimitCheck.Timing.ConfigureSampleClock("/Dev1/pfi0", 1000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 1000);
leftLimitCheck.SampleClock += new SampleClockEventHandler(LeftLimitReachedEvent);
leftLimitCheck.Start();
This works but an event from the pulse generation task would be the proper solution in my opinion
01-17-2017 07:58 PM
Pulse genration is an output task. The digital pause is a digital input. I have been trying without success to find a way to associate a digital change event with the pause digital input of the pulse generation task.
As a kludge I have setup another timer to use the pause event as a timing source. This approach was mentioned in another exchange on this message board.
Here's my code
leftLimitCheck = new Task();
leftLimitCheck.CIChannels.CreateCountEdgesChannel("/Dev1/ctr1", "checkLeft",
CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);
leftLimitCheck.Timing.ConfigureSampleClock("/Dev1/pfi0", 1000, SampleClockActiveEdge.Rising,
SampleQuantityMode.FiniteSamples, 1000);
leftLimitCheck.SampleClock += new SampleClockEventHandler(LeftLimitReachedEvent);
leftLimitCheck.Start();
This works but an event from the pulse generation task would be the proper solution in my opinion