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: 

Change input while running VI

Dear all, 

 

I have been developing a code to generate 2D image using intensity graph, where the user can control the scale of the graph by changing (user input X mm and user input Y mm).

I want the user to be able to control these inputs while the VI is running but it didn't work, I used event structure but its still not working, so what is the solution for such a problem?

( Please find attached the VI and SubVI)

Download All
0 Kudos
Message 1 of 5
(2,576 Views)

Hi Mariam,

 

THINK DATAFLOW!

This is the basic programming paradigm in LabVIEW - and you failed in obeying it…

 

When you want to read the X/Y controls more than once they should belong into a loop. Right now they will be read just once before the loop!

 

On your VI:

- Why is the data saving routine placed in the producer loop, using a local variable of the graph? Why not place it in the consumer loop, reading the data directly from that shift register?

- Why did you delete the label of the tab container? NEVER delete labels of controls/indicators!

- The subVI can be made more readable like this:

check.png

- Why don't you use a typedef'd cluster with your queue? Why do you use two different cluster constants with your queue?

- You don't need to unbundle the "Status" from your error wires just to OR them: boolean operations also can take error wires!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,555 Views)

Hi, thank you for replying to me.

 

I tried to put the user input in a while loop but its still not working, the new values will not be updated in the graph unless I stopped the program.

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

Hi Marjan,

 

I tried to put the user input in a while loop but its still not working, the new values will not be updated in the graph unless I stopped the program.

Then you made something wrong.

THINK DATAFLOW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,546 Views)

The "X" and "Y" controls need to be inside the loop.

The loop will only read these tunnels once, at the first iteration.

 

 

 

 

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