LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeating Call Library Function Node uses up all my CPU

Hi,

I'm not very proficient at labview or programming so any help would be gladly appreciated.

I bought a USB Digital Input/output hobby kit (one of those things you build yourself). I have got it made and i have managed to get labview talking to it. It was supplied with a .dll to control it and the digital output works a treat.

However, i want to monitor the ditital input channels (as fast as possible), but if i get a vi to repeatedly call the dll then all my CPU usage goes with it. I don't really understand what the dll does and how exactly labview interacts with it. Can i monitor the digital input channels without using up all my resources?

I wasn't able to attach the dll that i'm using so i renamed it .jpg instead. You can rename it to .dll to look at it if you want.

Thanks
0 Kudos
Message 1 of 4
(2,666 Views)
If you want to do something "as fast as possible" you are going to use up all your CPU, regardless of the program language you are using. You would get the same result if you just repeatedly added two numbers in a while loop. If you want the VI to be a good CPU citizen, then you should put a "wait until next ms multiple" inside the while loop to limit the speed at which the while loop runs. But then this wouldn't be "as fast as possible."
0 Kudos
Message 2 of 4
(2,661 Views)
Thanks Joe,

I know that if i put a small wait in then this will stop soaking up all the cpu power. However, i want to run this thing faster than once a second and yet still keep down my cpu time.

Is the only way i can call this dll (i.e. by repeatedly calling the dll) by using a code interface node? is this efficient?

Does this make sense?

Thanks
0 Kudos
Message 3 of 4
(2,651 Views)
By putting a small wait (of a few milliseconds) you can decrease CPU usage without affecting your performance too badly. However, it really depends on how long a single call to your DLL actually takes. Have you measured this? If it takes, say, a half-second for a single DLL call to execute, then small delays are not going to help because the bulk of the CPU usage is taken up by your DLL.

By the way, a CIN is not likely to help at all. There's not much difference in terms of overhead for a CIN vs Call Library node anyway.

Joe
0 Kudos
Message 4 of 4
(2,646 Views)