LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single boolean control, two mechanical actions

In my program, I have a single boolean control to indicate whether a mode of operation is on or off.

 

What I want to do is route this signal with latch mechanical action to a case statement - this case statement houses the VISA Write block for RS232 communcation.  The reason I want the latch action is because I only need to write to the serial port once to set the mode.

 

I also want to route this signal to a data processing Sub-VI, but I want this to be normal mechanical operation (switch when pressed).  The reason for this is that the data received from the serial port is processed differently depending on the current mode of operation.

 

Is there a way to do this without creating two controls?

 

Thanks for the help!

0 Kudos
Message 1 of 5
(4,663 Views)

I don't see any practical logic in what you are trying to do.  If action 1 is latched, which means it is read once then reset.  Action 2 is switched, which means it is read continuously until you reset it yourself back to false.

 

What action do you propose to tell the subVI that you want it to go back to false.

 

What is the different mode of operation that the subVI has?  How do you propose to signal it to go back to its original mode of operation?

 

I think you need to look at a state machine architecture (searh LabVIEW examples) to handle the at least 3 different states of operation you are proposing.

0 Kudos
Message 2 of 5
(4,654 Views)

All you need is a feedback node and then look at the current and immediately previous state of the button.

 

Use e.g. "implies" to activate the first case only if (new=ON, old=OFF).

Wire the button directly to the second case structure, so it remains on.

 

Have a look at this example and modify as needed.

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

OK, here's a quick example (LabVIEW 8.5). See if this works for you. 😉

 

If you want to trigger the first case with every change (on>off, off>on), use "not equal" instead of the negated implies. Modify as needed. 🙂

 

 

Message 4 of 5
(4,633 Views)

This looks great - I've never used the feedback node - probably why I couldn't think of what to do!

 

Thanks a lot for the help!

0 Kudos
Message 5 of 5
(4,604 Views)