LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reinitialize at Stop...

Solved!
Go to solution

Hello all,

My goals are two fold...

1) Reinitialize onscreen switches and buttons when I stop the program... I'm currently using the "Reinit To Default" Invoke Node in a Event Structure.  Works quite nicely, but doesn't exactly get me where I want to go... I'd like the While loop to run one more iteration to allow the signal from the reinitialize switch to get the signal to it's controls.. in this case the "Relay Sig1" LED.

 

2) I also have relays that I wish to disable upon shut down, currently I'm using a Select vi wired to the stop button, while this is effective, it is leading to a catastrophe of wires. (example Switch2)

 

Is there a more direct method of accomplishing either or both of these tasks? 

 

As always, a point in the right direction would be most appreciated!

 

I threw together a quick VI with both methods included and some explanation of what I'm doing.  It is attached.

 

Thanks!

Chad

0 Kudos
Message 1 of 14
(3,709 Views)

You could us a reference to this VI and an invoke node to reinitialize to default value. This should meet both of the goals you were after, assuming that the default value for the relay is off. You just have to make sure it runs after the while loop is stopped. 

 

Reinit to Defalut.png

0 Kudos
Message 2 of 14
(3,700 Views)

Ok, I'm going to show my ignorance here... I have no idea how to create what you have shown me.   I will admit to being pretty much completely self-taught so I'm sure I haven't been exposed to every menu/option available.  Can you give me a tutorial on how you created this?  ...it'd be much appreciated!

THX

Chad

0 Kudos
Message 3 of 14
(3,690 Views)
Solution
Accepted by topic author chuggins1434

chuggins1434 wrote:

1) Reinitialize onscreen switches and buttons when I stop the program... I'm currently using the "Reinit To Default" Invoke Node in a Event Structure.  Works quite nicely, but doesn't exactly get me where I want to go... I'd like the While loop to run one more iteration to allow the signal from the reinitialize switch to get the signal to it's controls.. in this case the "Relay Sig1" LED.


Simply write to a local variable of the control AFTER the loop has completed. Also note that there are simpler constructs to do your boolean logic near the bottom.

 

If you use an event structure, you should make sure to use (and discard) filtering events for "panel close" and similar so the shutdown sequence canot be bypassed.

 

Also for the relays, any shutdown sequence belongs after the loop or inside the shutdown state of a state machine.

 

 

Message 4 of 14
(3,688 Views)

What altnbach said will work too. But here is a little better explaination of what I was talking about and how to get the VI server refrence. Hope this helps!Reinit to Defalut2.png

0 Kudos
Message 5 of 14
(3,676 Views)

maybe this?

reinit.png

0 Kudos
Message 6 of 14
(3,675 Views)

Nice!  I learned something today!

 

Ok, riddle me this... if I take your bolean logic (much easier btw!), and put the local variable for Switch2 outside the while loop as you did for Switch1, it goes ahead and processes the closing of the Relay Sig2.  Why? 

 

..also curious as to why your local has a little  house looking symbol on it and mine does not.  I'm guessing it could be that I'm using LV2009..

C

0 Kudos
Message 7 of 14
(3,672 Views)

It closes the relay because it is also dependent on the STOP button. It would be simpler to remove all that logic and simply do it exclusively after the loop.

 

The local variables look different because of my idea here. (See Christina's final design here) 😄

0 Kudos
Message 8 of 14
(3,668 Views)

More replies!  Thanks guys!  I'm learning all kinds of good stuff today!  Robot LOL

0 Kudos
Message 9 of 14
(3,667 Views)

@altenbach wrote:

It closes the relay because it is also dependent on the STOP button. It would be simpler to remove all that logic and simply do it exclusively after the loop.

 

The local variables look different because of my idea here. (See Christina's final design here) 😄



i think your idea is better...cause i am not constantly polling the case statement and your code gets handled once,bingo?

0 Kudos
Message 10 of 14
(3,659 Views)