Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Incompressible time of 25ms with DAQmw Start function

Good evening
I am looking for a way to generate hardware signals from a proprietary protocol with PCI6224 board and DAQmx driver.
See attached photos.
However, after starting my DAQmx task, I find myself with a delay of 25 mS I can not minimize while my protocol requires a delay of 5 mS between each byte. How to reduce the time delay of 25 mS?

Someone can help me ?

 

BE CAREFUL : master (my bench) generate CLOCK ( taskHandle_timer ) for order and answer !

 

The source code:
To generate an order  

DAQmxWriteDigitalLines (taskHandle_DO, SAMPLE * TIME * numSamps, 1, TIMEOUT, DAQmx_Val_GroupByChannel, data, NULL, NULL);
DAQmxStartTask (taskHandle_timer);
DAQmxWaitUntilTaskDone (taskHandle_DO, TIMEOUT);
/ / DAQ mx start
DAQmxStopTask (taskHandle_DO);
DAQmxStopTask (taskHandle_timer);

To read a response
DAQmxStartTask (taskHandle_DI)  

DAQmxWriteDigitalLines (taskHandle_DO, SAMPLE * TIME * numSamps, 1, TIMEOUT, DAQmx_Val_GroupByChannel, data, NULL, NULL);
DAQmxStartTask (taskHandle_timer);
DAQmxReadDigitalLines (taskHandle_DI, SAMPLE * TIME * numSamps, TIMEOUT, DAQmx_Val_GroupByChannel, data_, SAMPLE TIME * * * numSamps numChannels_i, NULL, NULL, 0);
DAQmxWaitUntilTaskDone (taskHandle_DI, TIMEOUT);
DAQmxStopTask (taskHandle_DI);
DAQmxStopTask (taskHandle_DO);
DAQmxStopTask (taskHandle_timer);

NOTE taskHandle_DI, taskHandle_DO, taskHandle_timer are created in  
intialisation    function (global variable)

Thank you for your help

PS : excuse me for my poor english

Download All
0 Kudos
Message 1 of 4
(3,537 Views)

Hi Pierrick MADIOT,

 

By default, each call to DAQmxStartTask() has to execute the verify, reserve, commit, and start state transitions, but you can perform some of these state transitions earlier by calling DAQmxTaskControl(taskHandle, DAQmx_Val_Commit), so that DAQmxStartTask() will only have to execute the start state transition. I don't know how much time it will buy you, but it should help.

 

An explanation of the NI-DAQmx task state model is in the NI-DAQmx Help file (on the start menu) under NI-DAQmx Key Concepts >> Channels and Tasks in NI-DAQmx >> Tasks in NI-DAQmx >> Task State Model.

 

Some other approaches that might help:

  • Generating the clock using the DO task instead of the counter task, so that you can build a large DO waveform that contains multiple serial transactions. This removes software from the critical path.
  • Switching to LabVIEW Real-Time (if you're not already using it).

 

Brad

 

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 4
(3,509 Views)

Hi Brad

 

Many thanks for your informations. I tried to experiment with your advice when I have a little time

 

But you have a typical case (an example) allowing the use of all options of the function to know DAQmxTaskControl ()?
Or you advise me to place functions DAQmxTaskControl () in my code with what option to reduce the execution time?
I ask you a lot 🙂 sorry

 

Thank a lot

 

Pierrick MADIOT

 

0 Kudos
Message 3 of 4
(3,472 Views)

I don't know of a good C example for this, but here's a LabVIEW one that illustrates the basic concept: Acquire & Graph Voltage-Internal Clock-Hardware Trigger Restarts

 

The overall flow:

  1. Create the task, create the channels, configure timing/triggers, etc.
  2. Commit the task.
  3. Start/read/stop as many times as is necessary.
  4. Clear the task once you're completely done.

The important part is that this performs the reserve and commit operations only once, instead of doing them many times.

 

For output tasks, you will need to write before starting, but you already know that judging from the code snippet you posted.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 4
(3,447 Views)