LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make while loop run faster

i am trying to rotate a fan by customising the control. but my while loop runs so slow, it does not give the moving motion i am expecting. is there any way i can make it move faster?

0 Kudos
Message 1 of 6
(4,873 Views)

The problem isn't speed, it's that you only have a boolean and two states aren't enough to show simulated rotation. Try a picture ring control...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 6
(4,868 Views)

Matthew999,

 

It runs two iterations and stops. It takes less than 3 milliseconds to run.  It is so fast that the screen does not update.

 

I think you need two things: 1. A separate stop control. 2. A time delay.  Put a Wait (ms) timer function inside the loop. Create a control on the Milliseconds to Wait input. Try various values to see what looks the way you want.  About 34 ms looks reasonable on my computer.

 

You may also want to work on the alignment of the two images a bit.  They are different sizes and have both a translation and a rotation of the mounting bracket as well as the center of the blades.

 

Lynn

Message 3 of 6
(4,867 Views)

I would recommend you start with some simple LabVIEW turorials first, because your code makes no sense.

 

Why is there a while loop if it exits after one iteration?

Why is there no outer while loop? (Are you using continuous run?)

Front panel updates are asynchronous, and if you are using "continuous run", the updates are so fast that most are skipped.

 

Solution:

Use a single outer while loop.

Slow down the loop to the desired speed (e.g. 10Hz)

See attached draft.

Message 4 of 6
(4,862 Views)

thanks guy! onemore thing, you see in my attached Vi, there is huge gap between my picture and the outer square. How can i keep the size of the picture constant and make the size f the outer square coincide with the picture?

0 Kudos
Message 5 of 6
(4,856 Views)

That decoration is part of the boolean. Right-click...advanced...customize. Switch to customize mode (tweezers). delete the extra frame decoration.

(Of course you should also make sure that the two pictures are the same size and the fans are centered on each.)

0 Kudos
Message 6 of 6
(4,850 Views)