ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

PauseTrigger event

Solved!
Go to solution

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?

0 Kudos
Message 1 of 6
(4,397 Views)

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/ 

Maggie M.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 2 of 6
(4,353 Views)

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.

0 Kudos
Message 3 of 6
(4,351 Views)
Solution
Accepted by topic author joemg

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.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAn9SAG&l=en-US

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/ 

Maggie M.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 4 of 6
(4,334 Views)

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

0 Kudos
Message 5 of 6
(4,313 Views)
Solution
Accepted by topic author joemg

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

0 Kudos
Message 6 of 6
(4,312 Views)