LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control number of led flashes

Solved!
Go to solution

Thank you very much. I am not familiar with everything you just mentioned but I will do my best to get to now it.

You have been very helpfull.

0 Kudos
Message 11 of 14
(668 Views)

Did you understand about the CPU usage? LabVIEW will execute code very fast. This means that a loop will iterate as many times as LabVIEW can make it iterate. If your code is not doing anything but waiting for someone to press a button then your CPU usage will go way up. That means that everything on your system will go slower.

 

Try this experiment. Create a VI with nothing but a while loop. Connect a false constant to the stop terminal. Look at the CPU usage with the task manager and run the VI. Now put a 0mS wait in the loop and look at the task manager. If you have an eight core CPU you might not notice anything unless you create several of these loops.

=====================
LabVIEW 2012


0 Kudos
Message 12 of 14
(667 Views)

Steve is absolutely correct. The above example VI is one of the animals described here when it is not doing anything. If every program running on your computer would be programmed equally sloppily, the computer would be unusable!

 

 

 

 

Typically, the use of an event structure is a better choice. Now the outer loop only spins when it needs to. Place an indicator on the iteration terminal for both solutions to see the difference.

 

Overall, the example is also way overly complicated. Why would you need two inner FOR loops? Why would you need to expand an existing array one element at a time? (The first loop could be replaced by wiring the array to two inputs of "interleave array", for example). In any case, all we need is a single inner loop. With a little more code, we would only need the outer while loop, with the advantage that the blinking can be interrupted at any time. That would be important in the case on long blink sequences.

0 Kudos
Message 13 of 14
(662 Views)

@altenbach wrote:

With a little more code, we would only need the outer while loop, with the advantage that the blinking can be interrupted at any time. That would be important in the case on long blink sequences.



Here's a quick example for this. Modify as needed.

 

Download All
0 Kudos
Message 14 of 14
(656 Views)