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: 

Entering external value into the while loop

Solved!
Go to solution

Hello, i have the following problem. I am labviewe beginner and i created a simple program for logging data and controlling one laser driver. The problem is:

at the beginning i am entering the values of temperature and current - they need to be outisde of the loop becasue i want to include these start values in the header file which i append to the file at the beginning.

Then i am going into the loop, but if the control is outside i can't change the value anymore.

So this is the question: what to do to be still able to change these parameters without creating one more control?

 

Sorry for the mess in VI, but i am just getting started.

thank a lot

maciek

0 Kudos
Message 1 of 5
(2,590 Views)
Solution
Accepted by topic author helmik

Hello,

 

Quick solution, create a local variable for the control to use in the loop. Better solution, consider implementing a state machine design pattern and place everything before the loop in the first state, before moving to the main state (the stuff currently in your loop). That way you would be able to access the same control from both cases which is better practice.

 

Hope that helps,

Message 2 of 5
(2,565 Views)

Hey Paul, thanks a lot for helping.

When i was looking for thesolution i just found a lot about these state machines. before i didn't know it but indeed i think it will be really much better. After reading some tutorials i will try to remake this program 🙂

Thanks!

0 Kudos
Message 3 of 5
(2,550 Views)

Hey, i tried to change my program and use state machine design.

If anybody has some time and is willing to help me and tell me what can i do to make it better, simpler etc i will be more than grateful!

Download All
0 Kudos
Message 4 of 5
(2,521 Views)

Hi helmik,

  Have you tried using event structure without using any state machine..My idea is place a while loop and place an event strcuture inside it,where one event will handle timeout of 0ms and other will handle a value change event of external control..In the timeout loop,keep the processing logic,please pass the new value of external control to the time out loop using the shift register..Please correct me if am wrong.

 

 

regards,

SrikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 5 of 5
(2,513 Views)