From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Event structure inside case structure execute once

Solved!
Go to solution

You are right. However this still hasn't solved my original issue.

 

Each time the main loop iteration finishes, the sensor compares its reading with the desired one. If the case does not change (highly likely in one second) then it re-enters the same case and re-executes the loop. Therefore my stepper motor keeps turning 90 degrees every second.

 

How can I execute the For loop when the case is first selected, and then not execute it again until a new case is selected and different motors have to turn?

0 Kudos
Message 11 of 13
(1,106 Views)

Hi simos,

 

this has been answered before.

See message #8!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 13
(1,090 Views)

@simos wrote:

Thanks for your suggestion. Unfortunately following your example does not seem to execute the For loop just once and then move on. Single stepping completes the loop, and then does not exit the case structure, it reruns the For loop.


It runs the loop as many times as you tell it to.  That is the point of a FOR loop.  Not until all of the iterations have executed does it let the case structure end and then the program moves on in the dataflow.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 13
(1,072 Views)