Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Line Digital Output very slow with DAQmx

Hi Jonathan!

   Thank you for your interest!!!

   I've solved!  My problem was a little bit messy...

   I'm creating a dll, in which I have functions called from another sw (read, write, configure, etc....), and in the same dll, when  the first function is called, I start an infinite loop, in which I  continuously read data from input ports (that's for emulating interrupt lines.....), so, it can be that two "read" functions are called "same time", and they execute in 2 threads.  But that's not the problem with NIDAQmx (actually, it works!).   I was told that NIDAQmx allowss reading-writing on same tassks from different thread (great!).

   My problem was that the endless loop, ( while(1) .... readDigitalLines.....) was launched in a thread with THREAD_PRIORITY_TIME_CRITICAL, that's why my system hang!!!!!!

  Formerly, the system didn't hang because I didn't started the task (DAQmxStartTask...), so DAQmxRead function performed slowly. Nice, yep? 

  I solved setting

     SetThreadPriority(th, THREAD_PRIORITY_NORMAL);

    Now it's really good!

   Thank you again for caring about thiss matter! Have a nice day!

graziano
0 Kudos
Message 11 of 13
(1,514 Views)
Hello Jonathan,
many thanks for your clear explanation on the correlation between NI-DAQ Traditional and mx !
I agree with Graziano that it was the best comment ever read about this topic.

Technically I agree that time critical operations are a hard comparison test, but at least I can accept the slight decrease in performances for single point read/writes, taking into account that you offer more flexibility on all the other tasks and a real time solution for more stringent situations.

Since we had the great opportunity to get in touch with one of DAQmx team developers, let me ask if you can be so nice to address me to any technical document (more detailed or more extensively explained than the available "Helps") dealing with DAQmx Tasks and their implications in a program (for example, at the top of this forum exchange you may find that the answer to my problem was to start the task, this meaning that probably I have not read enough before programming 🙂 ).

Thanks a lot again and best regards,
Marco

0 Kudos
Message 12 of 13
(1,514 Views)
Another thing that you can do is to use the correlated digital output on the device, use an onboard counter to drive the clock of the correlated output task. With regeneration allowed, you would need to write a toggle pattern.

Jeff
0 Kudos
Message 13 of 13
(1,501 Views)