LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift Registers and Boolean ctrls

Hi Lars,

 

your own solution using data dependency of WAIT timers is what I called "THINK DATAFLOW"...

 

I would suggest not to connect the button to the connector pane. So it doesn't receive any value from mainVI, neither by wire nor by default...

When the button should be visible (and usable) all the time it should be placed in the mainVI anyway!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 30
(1,062 Views)

I have tried to think of a way to make this button usable from the main.vi...

The problem is that this specific program is so time-dependent and order-oriented that there are elements to the program that have prevented me from doing so.  It is meant for the user to input his initial data and values, click a 'Start' button, and then the program will run by itself for a good 2 hours with 0 user input, save for the potential of this "everything off" button.  Producer Consumer loops haven't been able to do it for me because when I want to freeze the program from the main.vi, it will always be in the middle of running a for loop in a smaller sub.vi.

 

Unless there is a way to pass real time input on the boolean control through about 4-5 levels of sub.vis, instead of being locked into the value of the main panel boolean when the 1st layer of sub.vi is called (which is pretty close to the problem I am having here anyway...) I am not sure how I can make that work.

0 Kudos
Message 12 of 30
(1,054 Views)

Make a functional global variable that holds the status of the emergency.  Have 3 actions:  Set Emergency stop, Clear emergency stop, and Do nothing (Default).

 

Now you can set or clear the emergency stop in the one or two locations you may have to do it.  Key thing is that you don't want to have a race condition where something sets the stop and another locations clears it and they fight back and forth.  Then you can have numerous locations that read the functional global variable that can read the current status no matter how deeply into loops or subVI's they are buried.

0 Kudos
Message 13 of 30
(1,047 Views)

Sorry Raven, but I am not exactly sure how to do that.

 

I made a sample sub.vi, attached.  It is a simple for loop that counts the iterations, and has a "Freeze" button attached to a while loop inside the for loop, which will freeze the iteration counter when pressed.

 

Can you make and show me a .vi that calls this example "Stop Button.vi" with a 'functional global variable' that can control the "Freeze" button from a higher level?

Download All
0 Kudos
Message 14 of 30
(1,043 Views)
0 Kudos
Message 15 of 30
(1,035 Views)

BTW I am using labview 8.5... 

0 Kudos
Message 16 of 30
(1,042 Views)

http://www.ni.com/white-paper/7585/en/

 

...could it be as simple as just right clicking on the button and making it a global variable?

0 Kudos
Message 17 of 30
(990 Views)

LarsUlrich wrote:

...could it be as simple as just right clicking on the button and making it a global variable?


Really? I have never heard of that...

0 Kudos
Message 18 of 30
(979 Views)

For instances like this I like to use notifiers. It is an easy way to broadcast your stop to as many sections of your code as necessary.

Check Stop Condition.png

 

The above code is a subVI that I place wherever I need to check for a stop. In the main UI code I would fire off the notifier to indicate a stop has been triggered.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 19 of 30
(964 Views)

@LarsUlrich wrote:

Sorry Raven, but I am not exactly sure how to do that.

 


See Ben's Action Engine Nugget

0 Kudos
Message 20 of 30
(945 Views)