LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop and For Loop dont stop executing

Hi,
I am working with LabVIEW 8.0. I just started on with the programming, while I met with a problem. Actually I found this when I used the "Highlight Execution" On when executing a program. The FOR loop does not stop even when the number of iteration specified was reached. Inorder to explain my program in a better way, I have attached a simple program(incrementing the numer and storing it in an array).
Even after 2 iterations(as specified by me in the program) the loop doesnt stop. U can notice that if u click the "Highlight Execution" button and examine the signal flow. Please suggest me a solution.

Yours faithfully,
R. Vishnu.
0 Kudos
Message 1 of 11
(5,626 Views)
The for-loop in your VI runs 3 times on my computer as specified by the number connected to the 'N'

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 11
(5,620 Views)
Were you using the Run continuously button? With a simple VI like this it would appear to not stop.

Thr Run Continuously button is intended for use in testing VIs where it is useful to have the VI run repeatedly while troubleshooting. It is not intended for normal use. If you need to execute a piece of code repeatedly, enclose it in a while loop.

Similarly the Abort button (red Octagon) is intended to be used , not as a routine Stop button, but as a backup means for the programmer to abort a VI which failed to stop normally.

Lynn
Message 3 of 11
(5,609 Views)


@johnsold wrote:
Were you using the Run continuously button? With a simple VI like this it would appear to not stop.

Similarly the Abort button (red Octagon) is intended to be used , not as a routine Stop button, but as a backup means for the programmer to abort a VI which failed to stop normally.

Lynn

I've got to agree with this. The Continuous Run button would be the only way this would be happening.

On the Abort button, I tell my students that using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

Ed



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 11
(5,594 Views)
Ed,

I really like that line about the Abort button. May I quote you with proper credit, of course?

It reminds me of an incident many years ago (before LabVIEW) when I was a volunteer firefighter. Someone had run off the road and hit a tree with his car. The tree was a big pine and it bent rather than breaking. The car was slightly airborne at the time. When the tree straightened up the car had twisted around and became wedged between that tree and its twin which was growing a distance slightly less than the length of the car from the first tree. It looked like a big "H" with the tree trunks as uprights and the car as the cross member. The landowner showed up with his shotgun and announced that he didn't care what they had to do to the car to get it out of there, but they were not to damage his trees any further. I don't recall how they removed the car, but the trees were intact. Definitely consequences!

Lynn
Message 5 of 11
(5,585 Views)


@johnsold wrote:
Ed,

I really like that line about the Abort button. May I quote you with proper credit, of course?

Lynn


Go ahead. I really like using that because it really drives home the difference between Abort and a Stop button.

You don't have any pictures of that car in the tree do you?



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 6 of 11
(5,579 Views)
Ed,

Thanks.

No pictures. It was at night and nobody carried cameras routinely back then.

Lynn
Message 7 of 11
(5,565 Views)

That line about the abort button qualifies for the LabVIEW Proverbs!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 11
(5,550 Views)
Hi,
Thanks for all who replied. I got it solved, it was the problem with run continously. I usually execute all my vi's using run continously button. Also thanks for the information about abort button.

Yours faithfully,
R. Vishnu
0 Kudos
Message 9 of 11
(5,515 Views)
Lynn said

It reminds me of an incident many years ago (before LabVIEW) when I was a volunteer firefighter.... (description of car in a tree.

Sort of like this: http://www.insurancehotline.com/romanov/car_in_tree.jpg ?
Message 10 of 11
(5,475 Views)