From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to execute a specific number of loops and stop

Solved!
Go to solution

Hi,

I now have a VI and I want to debug. There is a while loop in my VI. I am interested in what happens after a few iteration.

 

I want to do single stepping but not for a few loops at beginning. 

 

How can I do this?

 

Thanks in advance.

 

Chuan

0 Kudos
Message 1 of 9
(6,603 Views)
Solution
Accepted by topic author Dirichlet123

Use a conditional probe off of the iteration node of the while loop.  You may need to run a wire from the node to the edge of the loop if you aren't using the node already, then right click the wire and select Custom Probe->Conditional I32 Probe, then select the conditions to cause it to pause.

Jon D
Certified LabVIEW Developer.
Message 2 of 9
(6,602 Views)

Another option: put breakpoint in the loop, click Continue button a few times, untill it gets to required iteration, then turn on Highlight execution or single stepping.

Message 3 of 9
(6,573 Views)

Another option is to just place a breakpoint early inside the loop (i.e. on a wire that is before the bulk of the loop operations). It will pause with every iteration and then you can decide (e.g. based on the value of some other probes) if you want to unpause to immediately go to the next iteration or start single stepping or execution highlighting. (EDIT: just noticed that Alexander suggested the same thing while I was writing :D)

 

(the conditional probe may not work as expected because of the parallel nature of LabVIEW. There is no guarantee that the code will pause early in the iteration (but it most likely will ;)). It could theoretically be possible that a large chunk of the loop code has elapsed by the time the code is paused by the conditional probe.)

Message 4 of 9
(6,571 Views)

You could do both.  Set a conditional probe to stop it 1 iteration early, then use single stepping from there as necessary.

Message 5 of 9
(6,566 Views)

@altenbach wrote:

 

(the conditional probe may not work as expected because of the parallel nature of LabVIEW. There is no guarantee that the code will pause early in the iteration (but it most likely will ;)). It could theoretically be possible that a large chunk of the loop code has elapsed by the time the code is paused by the conditional probe.)


Raven beat me to it, but yeah, just stop on iteration sooner.

It should also be noted that saying a few cycles can be relative, it might be 5 iterations out of 100, it might be 105 iterations out of 100,000....

Jon D
Certified LabVIEW Developer.
Message 6 of 9
(6,546 Views)
Just an FYI. Because I think previous posts have already answered the OP's question. But in LabVIEW 2016 you can now program custom probes that will turn on the Highlight Execution when you want (i.e. after a certain number of integration is met).
Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



Message 7 of 9
(6,517 Views)

Here you go.

 

Highlight Execution

Message 8 of 9
(6,509 Views)

@scofield wrote:

Here you go.

 

Highlight Execution


While I do not in anyway want to call into question waht you shared scofield I am reply only to share my first reaction to seeing that code in the context of this thread. It think the correct term would be an;

 

auto-appendectomy

 

Smiley Wink

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 9
(6,502 Views)