LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to output string to a common indicator?

Solved!
Go to solution

Hi there,

  I have a stack sequence with 10 frame defines, there is a wait to delay 2 seconds between each frame. I have a common string indicator defined and I would like to output a string to that indicator in the very first frame before the codes between frame 2 to frame 9 is run ... and I would like to output another string to the same indicator at the very last frame to indicate all code finished. But I find that there is no way to share the indicator by two constant string defined in different frame. Any idea? Thanks.

0 Kudos
Message 1 of 5
(3,764 Views)

Local Variables.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Use a flat sequence rather than a stacked sequence.  The stacked sequence hides code unnecessarily.

0 Kudos
Message 2 of 5
(3,761 Views)
Solution
Accepted by topic author dragondriver

Use local variable or property node value of that common indicator in all the sequences

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 5
(3,759 Views)

Stacked sequences are not recommended in general, and you should rewrite your code into a proper state machine. Now keep the string in a shift register and append to it whenever a state needs to do so. Update the indicator outside the state cases, once per iteration of the outer loop.

 

If you keep adding code to a fundamentally flawed architecture, you'll simply have more problems cleaning up the code in the future. Do it now, while the code is still manageable! 😄

 

I strongly recommend against the use of local variables in the way outlined by some others. You are simply making bad code even worse. For each operation you would need two local variables (read from local, modify, write to local), cluttering and complicating the code structure unecessarily, creating additional data copies in memory, and potentially introduce race conditions because there is no way to tell what code section wrote to it last.

 

If you need help redesigning the code, post it here and we can give some recommendations.

 

As a quick bandaid solution, you could also keep the string in an action engine with several modes (read(default), init, write, append, etc.).

0 Kudos
Message 4 of 5
(3,721 Views)

I completely agree with Altenbach that state-machine design are significantly more advantageous - especially when design starts growing. It is fairly easy to replace your stacked structure into a case-structure based state-machine design... attached is an example on how to do that. It may look like extra coding at first, but once you get a bit used to LabVIEW you'll see how easy it is to expand upon.

 

-DP

 

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


0 Kudos
Message 5 of 5
(3,708 Views)