LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change detection and CPU usage

Hi

I am using the example 'Read Dig Chan-Change Detection.vi' (from the DAQmx/Digital measurements examples) to detect changes on a single line of a PXI-6528.

When the system is waiting for the digital input to change, the CPU usage (viewed in task manager) sits at 100% - this seems to me to be excessive - I thought change detection was intended reduce CPU usage.

I'm using Labview 7.1, DAQmx 7.2, windows XP (SP2).

Is there a method of reducing the CPU usage with this function or should I abandon change detection.

Any suggestions would be appreciated

Nick
Message 1 of 7
(3,827 Views)
Hi Nick,

Try putting a small delay in the loop, this will allow the processor some time to do other things, rather than trying to perform these functions as fast as possible. The delay only needs to be 1 or 2 milliseconds and the CPU usage will be reduced from 100%.

Hope this helps.

Hannah
NIUK and Ireland
0 Kudos
Message 2 of 7
(3,759 Views)
Hi Hannah
Thanks for replying

The changes on the digital input occur only every few seconds, the 100% cpu usage occurs when DAQmx read is waiting for a change, so adding a delay makes no difference as the loop does not repeat until a change occurs.

Nick
0 Kudos
Message 3 of 7
(3,750 Views)
what you will have to do is open the 'Read Dig Chan-Change Detection.vi' and inside there is a while loop, Inside that while loop place a wait function with aleast 2mS time and this will cure your 100% CPU usage,the more wait time you use in this vi the better it will be on usage, if what you say is tue that it only updates every couple of seconds then a 100mS wait would be great. play around with it and see how much of a wait you really need.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 7
(3,724 Views)
Putting a delay in the while loop makes no difference unless frequent and regular pulses are occurring.

The pulses I am looking at are random they could be many seconds or just a 100 milli seconds apart.

The while loop is not continually cycling as it only completes and continues to the next cycle if a change occurrence happens, during this wait period CPU usage is 100%.

If I remove the while loop and make the vi a single operation change detection with a timeout of 10 seconds, then if no change occurs the CPU usage will be at 100% for 10 seconds until the vi times out.

Maybe this is how it is supposed to be, but I would have thought not.

Nick
0 Kudos
Message 5 of 7
(3,707 Views)

My understanding is that the 100 % CPU issue is addressed in DAQmx 7.4. There are a few very nice features added that make it much more than worth the download!

Download DAQmx

Dan Press
Certified LabVIEW Architect
PrimeTest Corporation

Message 6 of 7
(3,703 Views)
Changing to DAQmx 7.4 sorted the problem

Thanks

Nick
0 Kudos
Message 7 of 7
(3,668 Views)