LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop in a table control?//Enable write with keyboard in table control?

Hello, in my labview, I have a table control, which I fill in with a run time menu, after filling in the rows I want, the serial port reads row by row. I have a case that is called goto, its function should be to create a loop between the row where you add it and the number that you put in "Value". I can not implement it correctly, because apart from this, I can not write with the keyboard to the table control when the program is running. I hope someone can solve some doubt, thank you very much.
0 Kudos
Message 1 of 6
(2,577 Views)

Hi Aleix,

 

I can not write with the keyboard to the table control when the program is running.

Because that "Control table" is NOT a control, but an indicator!

 

Please rework your VI to use NO local variables, but a shift register to hold your table data. Then switch the table to be a control…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,570 Views)

Ok, thanks, what a fail! Why i can't work with local variables? Isn't good?

The first doubt i explain(implement a loop with "goto"), you have any idea how to do it? Thank you so much for you help!

0 Kudos
Message 3 of 6
(2,555 Views)

Hi Aleix,

 

Why i can't work with local variables? Isn't good?

As long as your VI runs without errors it's "good"…

 

That being said two reasons why you should avoid them when possible:

Local variables make it easier to create race conditions.

Local variables enforce data copies in memory.

 

(implement a loop with "goto"), you have any idea how to do it?

What is a "goto" (in LabVIEW context)?

 

Idea: Maybe you need to learn about using state machines…

Best regards,
GerdW


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

I have a case that is called goto, this function should be to create a loop between the row where you add it and the number that you put in "Number". If you open the vi, you'll see that it's a case, inside of an event structure, for the run-time menu. I don't know how to implement this, because i need to link the number in "Number" with the row with the same number. For example, if i select "goto" in run-time menu and write 1 in "Number", this action make a loop between 1 and the row you place goto, in "Value" you write the number of loops you want to do. After that, i read through serial port, that's why i want a loop, to read the table control X times sequentially, and when it finish the loop, it still reading sequentially.

Thank you.

 

0 Kudos
Message 5 of 6
(2,536 Views)

Hi Aleix,

 

For example, if i select "goto" in run-time menu and write 1 in "Number", this action make a loop between 1 and the row you place goto, in "Value" you write the number of loops you want to do.

So you want to implement a "FOR loop" instead of a "GOTO feature"!

A "FOR loop" needs (atleast) two parameters: the number of iterations and the position of the related "NEXT" as in text based programming like BASIC:

10 FOR x = 0 TO 9
20    do something
30 NEXT x
Best regards,
GerdW


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