LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU usage

I have a question regarding CPU usage while writing/reading digital I/O lines.

Whenever I've needed to write or read a digital I/O line, I have been following
the following procedure that I gleaned from several of the examples in NIDAQmx

1. DAQmxCreateTask
2. DAQmxCreateDOChan   -- for an output line
3. DAQmxSetChanAttribute
4. DAQmxStartTask
5. DAQmxWriteDigitalLines
6. DAQmxStopTask
7. DAQmxClearTask

This worked fine as long as I  used this procedure very infrequently (once a minute or so),
but I noticed that if I used it every 2 seconds, my CPU usage was very high (~70%
according to the Wiindows Task Manager), even for a single output line. Since I
need to operate a few more digital lines in this fashion, I'm concerned that the CPU
usage will go up even more causing other applications on the PC to slow down.

Would CPU usage go down if I performed steps 1-4 at the beginning of the program
and only perform step 5 every 2 seconds as my application calls for? This implies
leaving the task in a started state. Are there any other implications to this?

My system is:
AMD Sempron 2200 with 1G memory
Windows XP Home with SP2
PCI-6503 NI digital IO card
NIDAQ 8.1.0
LabWindows/CVI 7.1

Thanks in advance.

Chandan
0 Kudos
Message 1 of 4
(3,869 Views)
I have assigned tasks at program load time, and only call DaqmxWriteDigitalLines() or the write word functions as needed.  I have never had any issues even when using a large number of tasks over long time periods.   I split the dio card into multiple ports/tasks and stored the all the task handles in an array.  Worked great.  Calling all the functions to setup/start/end/closeout a task is just a lot of overhead that is not required.

Message Edited by mvr on 07-20-2006 02:00 PM

Message 2 of 4
(3,866 Views)
Thanks mvr. Your suggestion improved my CPU usage a whole lot.

Chandan
0 Kudos
Message 3 of 4
(3,860 Views)

Very happy to hear it worked out.  Thanks for posting the results.

Good Luck

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