Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

single pulse repeated

I am using NI-DAQmx on an M-series device (in my case, PCI-6229, but my customers may use just about anything). I am writing in C++ using VC++.net.

I would like to be able to set up a counter to produce a one-shot pulse, and then be able to repeat that pulse under software control at any time I wish. It would be best if I could avoid setting up the task repeatedly.

Here is the sequence of calls I use (the actual code is not this neat because it is driven by a hosting application):

DAQmxCreateTask(&h)
DAQmxCreateCOPulseChanTime(h, namestr.c_str(), NULL, DAQmx_Val_Seconds, DAQmxValLow, 0, timelow, timehigh);
DAQmxStartTask(h)

It would be nice if at a later time (after the initial pulse is finished) I could call DAQmxStartTask() again to produce another pulse.

The question: is there a property or something that I could set to allow re-starting the task without the setup time required to destroy the task and re-create it?

Is there some call that will repeat the task without the setup overhead?
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 1 of 5
(3,219 Views)

John...I have never tried this for counters but in theory this is how you would want to set it up.

  1. Create Task
  2. Create Channel
  3. Call the DAQmx Control function and set it to the committed state
  4. Call Start
  5. Call Wait until done-->ensures you are done before step 6
  6. Call Stop
  7. Next time you want to generate the pulse go back to #4-#6

StuartG

0 Kudos
Message 2 of 5
(3,209 Views)
Thanks, Stuart, that makes sense. I will try it when I get a chance.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 3 of 5
(3,200 Views)
That did the trick! Thanks much!
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 5
(3,190 Views)
np...glad to be of help
0 Kudos
Message 5 of 5
(3,181 Views)