LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Latch for Stop Test Function in Loops

Solved!
Go to solution

Good morning!

 

I'm working on a project to control a Chroma Progammable AC Source Model 61604 through LabVIEW, and I'm having an issue where my "Stop Test" button isn't behaving exactly how I'd like it to. I switched the mechanical function to a switch, which is unfortunate because I'd really prefer it as a latch.

 

It has to penetrate multiple loops in multiple cases, so I'm using local variables currently which required me to change the function of the button to a switch, but I'd prefer to keep it as a button.

 

Is there any way to allow a latched button to go through multiple places? Can event structures be used for that without holding up any loops? (I found that one of my event structures was holding back a loop from its function so I'm a little more wary about them now)

 

Thanks in advance,

 

Anthony

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

Good morning everyone,

 

I am working on a code to operate an AC source, and besides my loops (the the rest of it) being a mess, it's mostly functional now. I am looking into alternatives to what I have right now for a "Stop Test" function. I have it set to a mechanical switch, when I'd prefer to keep it as a latch.

 

Is there any way to operate a latch within multiple nested while loops? Can I use an event structure that triggers on value change to set the stops to true without holding back my while loops from normal operation? (I tried this with something else and found I was having an issue with it holding up a loop)

 

Thanks in advance,

 

Anthony

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

What is wrong with using the switch action?  Latch means it resets itself once it is read, which is why it is incompatible with local variables.  How does it know to wait until every local variable has been read?  And some may never be read.  You can effectively make the swtich behave like a latch if you wire a false to a local variable of that, but make sure it only executes after all of your other loops have finished.

 

You could use a notifier as a means to send a notification to every loop that the stop button has been pressed.

 

You can keep an event structure from holding up a loop by wiring a zero to its timeout node.

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

This got posted way later than I intended. Like you suggested, I wired a timeout of 0 and a timeout case a little bit ago and it solved the issue and I was able to revert it back to a latch.

 

The reason I didn't want a switch action is because I wanted to be able to reset the "Stop Test" button with the least inconvenience to the user, so that the program can run multiple tests from the same application without having to worry about if "Stop Test" is still switched.

 

Thanks for the reply RavensFan!

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

Glad it helps.  There are a few ways of doing things.  Some might be better than others, and which is better could vary with your situation.

 

There should be no inconvenience with the user even with a switch action.  You can always be sure it is set back to false when your VI begins, or set back to false right before it ends (which is what I was suggesting above.)

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