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