LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Output Multiple Times

Hi

I have a case structure and need to use the same output in both cases. Is there a way to do this? If I try to copy to output it just creates one with a new name. I can't wire it outside since it depends the outputs need to be inside the case. There are some images and a better description at this link https://stackoverflow.com/questions/59974913/labview-using-output-multiple-times

Thank you

 

0 Kudos
Message 1 of 6
(3,189 Views)

Can you post your VI with where you are now?  I don't quite understand what you are asking.

 

A case structure doesn't "use" and output.  It can use data that comes into it.  It can provide data to an output.

 

If you have multiple cases that need to provide data to the same output, then the output terminal belongs outside of the case structure.

 

 

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

I guess when you say "output" you mean the terminal of an indicator. And you said you can't put the terminal outside the case structure because you have a loop inside the case structure and want it to update in real time as the loop runs. In my opinion, this isn't the best coding practice - generally if two cases of a case structure need to output to the same terminal, that terminal really should go outside the case structure and you need to architect your program with the long running loop on the outside.

But if you want a simple solution that you can just use without making big design changes - just use a local variable (right click on each terminal, click Create >> Local Variable).

0 Kudos
Message 3 of 6
(3,135 Views)

Sorry I dont have access to my code right now, but here are some images I that I managed to grab before hand. I am trying to put the Zone output into the case stament when it is false. I dont think i can put it outside, since then it wouldnt update the outputs as I want, unless there is some setting that will fix that.

n12iki_0-1580333960815.png

n12iki_1-1580333986570.png

0 Kudos
Message 4 of 6
(3,133 Views)

Thanks you understood it right, sorry that it wasn't clear. I will try to do that once I get back to the program again. I am not used to coding in labview so I still think in terms of coding langauages I am more used to.

0 Kudos
Message 5 of 6
(3,126 Views)

OK.  So now you show the code, I see the issue is that you want to do outputs in another case that is a couple of structures outwards from the original case and case structure.

 

Yes there is a way to update the terminals in a different location of the program.  Use a local variable of that terminal set to write.

 

I'm loathe to recommend local variables to newer users because we find that new programmers are far more likely to abuse them as if they were a "variable" in a text based language.  But I think that in your situation, you'll be just fine.

 

It looks like you have even more code outside of the picture you gave us, so it's hard to know what else is going on.  I assume there is another loop somewhere.  I hope there are other activities going on and that you are creating a greedy loop that burn CPU cycles when the code is setup to run these false cases.

 

If you weren't aware of local variables before now, then I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

0 Kudos
Message 6 of 6
(3,030 Views)