From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lacth until release switch control by global

Solved!
Go to solution

I have two (2) "latch until release switches" inside an event structure. The structure is set for 500 mS. How can I control these swiches with a global value? Is it even possible? Should I and try and put the two VI together?

 

Thanks

 

Philip

 

 

0 Kudos
Message 1 of 11
(2,155 Views)

"How can I control these swiches with a global value?"

You can not. Change the action to a no latch. Then you can add a local variable, to the end of the switch action,

so you can simulate the latch action.

 

"The structure is set for 500 mS", "Should I and try and put the two VI together?"

That makes no sense to me. You must discride a little better, what you want to do.

0 Kudos
Message 2 of 11
(2,133 Views)

Hi Philip,

 

What exactly are you trying to do?  Could you post an example VI?  Thanks!

 

Kristen H.

0 Kudos
Message 3 of 11
(2,091 Views)

pnielsen@gplains.com wrote:

I have two (2) "latch until release switches" inside an event structure.


Why did you decide on this relatively exotic mechanical action?


pnielsen@gplains.com wrote:

The structure is set for 500 mS.


Are you talking about a timeout (ms) or a conductance (mS)? Why would the timeout matter is you have an event for the switch?

 


pnielsen@gplains.com wrote:

How can I control these swiches with a global value?


What is a "global value"? If you man "global variable", You have things backwards. Global variables don't "control" events.


pnielsen@gplains.com wrote:

Is it even possible?


What is "it"? In LabVIEW everything is possible if you do it right and don't impose narrowminded restrictions on the code. 


pnielsen@gplains.com wrote:

Should I and try and put the two VI together?


This is the first time you are talking about two VIs. Does this have anything to do with the rest of the post?

 

 

Can you explain what the program should do from a user perspective?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 11
(2,088 Views)
I believe I may have the answer. I used a lacth switch to test the MB interface. I have now added a value to the switch. And I have changed the switch "to change when pressed".
0 Kudos
Message 5 of 11
(2,083 Views)

That code looks very confusing. So you basically wait for a "value change" of the control and then write watever value is in the global to the control just pressed, ignoring watever the user just tried to set. THe code fights the user!

 

If you really want it to work that way, make it an indicator, wait for a "mouse down" event on it, and wire the global directly to the indicator. No need for a value property.

 

In any case, it seems weird to wait for a user interaction. Shouldn't it update automatically whenever the global changes? 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 11
(2,061 Views)

I wrote the VI with switches. The switches would allow me to test the modbus out.

Later I needed to automate the VI.

So I needed to delete the swithes.

 

I created a True or False global from my GUI VI.

 

My GUI has 5 variables that I pass or read. Read Register, Write Register, Address, Quanity, Read Temperature address and Pass a 1 or 0.

 

 I have a data array that is 4 by 30.

 

Philip

0 Kudos
Message 7 of 11
(2,054 Views)
Are we still talking about the same thing? Your latest post appears to be just a collection of unrelated statements.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 11
(2,047 Views)

I have enclosed a jpg file of the front panel. I tested the MB interface by filling in the Write/Read and all the rest of the data required. Then I pressed the querry button and all data was written or read. I used the open button and query button to test the MB. The MB interface at the present time works in latched postion only. This is with no globals passed. That is my problem.

Thanks

Philip

0 Kudos
Message 9 of 11
(2,040 Views)

It would have been more helpful if you attached a picture of the block diagram, or better yet, a copy of the actual VI.

 

I am going to assume what you have now is a VI that has a while loop and a stop button.  And the real heart of the code is in a case structure that your switch is wired to.

 

Now you want to make this a subVI a part of a larger program. ????

 

If so, you need to change out the program runs.  It won't need a while loop or a stop button, it won't need a switch to call the heart of your code.  You will want to take the heart of your code and wire the important things into your connector panel.  Things like the modbus cluster and the output array.  Also, things like slave address and com port.

 

To really do it right, take a look at action engines where you will have 3 major actions:  open, write, close.  That way you can open the port one time before your while loop in your main program.  Write/Read within your while loop as needed, then Close the port as a final cleanup step after your while loop before your main program ends.

0 Kudos
Message 10 of 11
(2,029 Views)