LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cpu uses

Solved!
Go to solution

Hi,

I’m trying to create software that send and receive telegraphs to/ from COM port, analyzed the received massage and change some Slider proportional to the transmit slider (4 parallel loops in the same program). The problem is that sometimes it works good and sometimes I get Timeout error (from VISA). When I’m looking at my computer Task Manager I see that the CPU is at his full capacity (99%). Why is that? I don’t think that simple software like this one is suppose to use all CPU uses.

 

*- I’m using the Basic Serial Read and Write example that has been divided into two parallel loops (one for Write and One For Read) 

 

Thanks,

Idan

0 Kudos
Message 1 of 7
(3,207 Views)

The problem is: You are trying to run your software all the time without giving time for the windows to perform the other tasks.Did you place a time delay in all the loops for atleast 10 ms?. If no do that you will not see the 99% use of the CPU. Am not sure about the Serial port error.

 

Smiley Wink

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 7
(3,201 Views)

In other words, you probably have a Greedy Loop .

0 Kudos
Message 3 of 7
(3,185 Views)

Post your code and we can help or if that is not possible show us a picture and we can help. otherwise we just have to guess.

Tim
GHSP
0 Kudos
Message 4 of 7
(3,180 Views)

Hi,

Attached Herewith is my code (only two parallel loops):

Loop one- assemble array from Heather, state (Enum), Slider, Boolean and Checksum

Loop Two- Analyzed the array (calculate Checksum) and present the Slider, State and Boolean values.

 

This code use 80% of the CPU resource.

Do you know why?

 

Idan

Download All
0 Kudos
Message 5 of 7
(3,154 Views)
Solution
Accepted by topic author iozana

Idan,

 

You not only have greedy loops, you have infinite loops.  Those are loops which will never stop.  With False constants wired to the Stop when True termination terminals the loops will never stop.  LabVIEW works on the dataflow paradigm. This means that the next part cannot run until the first part finishes.  The outer loops will start but never finish their first iterations because the inner loops run forever.  On a multicore processor both loops might run, completely hogging two cores.

 

Fix? Remove inner loops.

 

Note that Property nodes are not a good way to transfer data between parallel loops.  They are slow and force the loop to execute in the UI thread.  Learn about queues for the data transfer.  Also, having two different controls (indicators) with the same name can lead to problems.

 

Lynn

0 Kudos
Message 6 of 7
(3,149 Views)

 

It helped!!

Thank you very much.

Idan

0 Kudos
Message 7 of 7
(3,134 Views)