LabVIEW Channel Wires

cancel
Showing results for 
Search instead for 
Did you mean: 

Why and when is a Tag Cleared?

Solved!
Go to solution

So I made a simple Tag Channel where I need to signify a stop between a loop, and a set of code that will take an unknown amount of time to execute.  So I write to the tag when the operation is complete, which stops the loop.  But I realized there is no point that I write a false to the channel, only a true when it is done.  Yet the channel is set back to false when I enter this loop again.  

 

I obviously like this, but am interested in knowing when a channel is reset or cleared back to the default data of that data type.  Is it simply when that channel wire isn't being used anymore?  Can I reliable use this type of design expecting the value to be reset?  This seems like beginner stuff but I couldn't seem to find anything on it in my poor search terms.  Thanks.

 

Example_VI_BD.png

Message 1 of 8
(10,607 Views)
Solution
Accepted by topic author Hooovahh

Once both of your inner code is finished the Channel Wire for the Tag is also finished - the Writer and Reader are no longer needed.  When the outer loop comes around again the Channel Wire is reinitialized.

 

In your code the Reader doesn't have an update from the Writer after creation so it till return the default value for the data type.

 

Good question - what's happening in the background?

 

See Understanding the Lifetime Of Channel Wires Section:

http://zone.ni.com/reference/en-XX/help/371361N-01/lvconcepts/channel_wires_intro/

 

You'd have to pay more attention if you make subVIs and they are not in the same overall loop I think.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 2 of 8
(10,597 Views)

Sorry - hit Post too soon on first message - edited my response.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 3 of 8
(10,592 Views)

> You'd have to pay more attention if you make subVIs and they are not in the same overall loop I think.

 

Not really. It's still on the next iteration of the diagram that contains both endpoints. So just find the common diagram of those subVIs. When that next iterates, the channels are reset.

 

If you think of the channel as connecting two subprocesses within an outer process, the reset is when the outer process iterates, starting the two subprocesses over (exactly as if they were a subroutine).

Message 4 of 8
(10,574 Views)

I was more thinking if the writer and reader were in two separate running loops that did not have a surrounding loop - true parallel modules that would not end and restart, but stay running until the application is shut down.  You'd have to reset the Tag yourself since the application wouldn't be starting over.

 

That still falls under your description - the outer process then becomes the top application.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 5 of 8
(10,566 Views)

@RVallieu wrote:

I was more thinking if the writer and reader were in two separate running loops that did not have a surrounding loop - true parallel modules that would not end and restart, but stay running until the application is shut down.  You'd have to reset the Tag yourself since the application wouldn't be starting over.

 

That still falls under your description - the outer process then becomes the top application.


Bingo. It just means the outer process never iterates.

 

My rough translation of Terry Pratchett's description of The Great Clock: It has a second hand, a minute hand, an hour hand, a day hand, a week hand, several different month hands, an odd hand-like thing for years that handles leap year, a century hand, an eon hand. And then there's the Biggest Hand. It only goes around once.

0 Kudos
Message 6 of 8
(10,560 Views)

I did earn my Channel Wires badge!  😄

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 7 of 8
(10,558 Views)

It seems that the badge system updated and the channel badge disappeared?  Along with some of your other badges.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 8 of 8
(8,001 Views)