LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indicators clears when stops Subvi

Solved!
Go to solution

Hi all.

 

I have a problem with a subvi that contains as an output terminals a graph and an array. When I run the vi all is ok, but when I stop it, both clears and resets to initial value (0).

 

I've notice that if I disconnect this indicators from terminals, the data remain and don't disappear. Why is it happend?.

 

Thanks in advance and regards to all.

0 Kudos
Message 1 of 9
(3,205 Views)

Thats because in the "false case" you are wiring an empty array value to the "array property node"

 

Guru 

Regards
Guru (CLA)
0 Kudos
Message 2 of 9
(3,199 Views)

Hi,

 

I'm not sure if I'm following you, but it seems to me that you are testing your sub-vi running it continously.

When you do this, every iteration will be like a new run of the vi with the start in true or false status.

If you have a control defined as a terminal, LabVIEW has to take care that it will simulate a call to this sub-vi with start being false. In this case, the control will have its default value.

I'm not sure how you want to use this, but if you make it a sub-vi, you will allways get the default value of the graph (empty) when you call it with start being false.

 

Perhaps if you explain better what you want to do, we can help you more.

 

Best Regards,

Paulo

0 Kudos
Message 3 of 9
(3,195 Views)

Hi Guru,

 

I think he's complaining of both the indicators (Graph and array).

The array is obvious, but the graph is also being cleared to its default value.

 

Best Regards,

Paulo

0 Kudos
Message 4 of 9
(3,193 Views)

Paulo,

 

looks like the graph has been defaulted some how in the false case (but dont know how)

Just place another graph and this new graph retains the value

 

Guru

Regards
Guru (CLA)
Message 5 of 9
(3,189 Views)

Thanks both to the response.

 

Guru, I put the "zero" value of the array in false case because I want to reset graph and array when stops the adquisition. 

 

This subvi begins to a main Vi that adquire data from 4 channels and represent in a 4 graph, so, the "start/stop" control comes from the main Vi and each channel is independent from the other.

 

Now, when I starts adquisition in any channel and pause it, for example,  data disappears from graph, and would be present. 

 

So, the only reason I've found is that when I disconnect graph from terminal, data remains in it, but of course in this way I don't have data in the main.

 

Perhaps my explication is not so good, I include another example with a full function of it.

 

 

0 Kudos
Message 6 of 9
(3,172 Views)

How are you running this VI?  I'm afraid I know the answer, but please don't tell me you are using the "Run Continuously" button.  That is only intended for debugging purposes.

 

Your Waveform graph clears because your VI is restarting, so all indicators go to their default values.

0 Kudos
Message 7 of 9
(3,156 Views)
Solution
Accepted by topic author Pelicar

Pelicar,

 

When you call a sub-vi, from any top level vi, all the controls that have no data supplied from your top level vi will be reset to their default values. To avoid this you should store your data somehow (using global variables, shared variables or shift registers).

This said, and because you for cycle has a 1 connected to theiteration count terminal, it seems to me you are trying to do a functional global.

Shift registers retain their previous value if they are uninitialized and you are initializing yours.

 

I'm attaching a vi with a slightly different implementation. check if this is what you need.

 

Hope this helps,

Paulo

 

Message 8 of 9
(3,150 Views)

Hi.

 

Paulo, thanks for your code. It has solved my problem, is exactly what I was looking for.

 

Regards

0 Kudos
Message 9 of 9
(3,117 Views)