Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

HW Timed Single Pulse generation speed

Hello!

 

I'm looking for a recommendation on how to speed up a counter pulse generation.

 

Currently I am generating a clock tick using a counter, and routing this counter through the PXI back plane and into several multifunction DAQ cards to acquire one sample of data (multi channel from all the DAQ cards) for each loop iteration. 

 

There are several reasons I do this:

 

  • I need 1 sample (multi channel) of data from multiple DAQ cards per software loop, identical to a control loop.
  • I have to time the loop based on a software IRQ, specifically a reflective memory ScramNET card.  I cannot use pulse trains or external hardware clocks.  I have to use the software IRQ as the synchronizing clock, thus I need to trigger the pulse for every IRQ received in software.
  • I use a HW Timed Single Point Read for each data point, with the card channels in parallel.  Software Timed On Demand is a slower process, and won't multi-thread and thus parallelize like HW timed will.
  • I run the multifunction DAQ cards in parallel for synchronization and maximum speed.
  • They are X series cards, but the X series DAQmx Task synchronization doesn't work across multiple DAQ cards for single point I/O.  Thus I need to create and route the pulse through the chassis.
  • I create a DAQmx counter pulse with a very small time duration.  Since the pulse has to occur immediately after the software IRQ, this seems like the only way.  I've debated starting a pulse train and tweaking the frequency to realign every so often, but that sounds a little convoluted.

The only way (currently) I can fire this counter pulse is by Starting and Stopping the task each iteration.  Even the shipping examples do it this way.  Using Execution Trace Toolkit, it's clear that the Counter Start Task takes 168 uSec, and the Counter Stop Task takes 100 uSec. The total of 268 uSec is a lot of time, and limits the ultimate loop rate I can run.  My Single Point Read (only) takes 226 uSec (and runs in parallel multi-thread which is great).  So the pulse generation consumes a lot of time relative to my desired loop rate.

 

I've been doing it this way for some time, but I would like to speed up the pulse generation somehow.  Starting/stopping the counter task with each iteration seems inefficient. But alas I'm no expert on counters.  If needed I can attach any VIs.

 

Thanks for any help!

 

Patrick

 

0 Kudos
Message 1 of 3
(5,182 Views)

Hello,

 

For speeding up your program you should implement the DAQmx Control Task VI into your program. What the VI does is when you stop the program the driver state does not revert back to the original setting, but a hardware reset setting. As you found the Start and Stop Task VIs take a certain amount of time based on system configuration, and the hopefully the DAQmx Control Task VI will allow you to reduce this time. I have attached additional links below that give you more information on what the VI does and how it is used. 

 

http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/ - the different stages

http://zone.ni.com/reference/en-XX/help/370469AA-01/lvdaqmx/mxtaskctrl/ - how to set the VI up

http://digital.ni.com/public.nsf/allkb/3D9CF4F4A0549F40862574420029ECCD - an example 

 

 

Karen M
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(5,156 Views)

Thanks for the quick reply!

 

Wow!  That knocked the Start/Stop time down to 44/17 uSec, a huge improvement!  I had not see that one before, so I'll have to experiment with it more in my other applications.

 

Thanks so much!

 

Patrick

0 Kudos
Message 3 of 3
(5,150 Views)