08-01-2013 10:28 AM
Attached are 2 images of sub.vis buried deep within a program I am making - the goal was to make a giant "turn everything off" button that would work at any time during the main program's excecution.
The program shown in attachment "Block 2" is one section of what is basically the 'heartbeat' of my program, and it is called in the .vi shown in "Block 1" with the label "1 second read, hereby renamed to 2 second read".
The main program calls the front panel of the 2 second read program, so that the boolean button "Emergency Stop" (shown on "Block 2") can be pressed at any time.
When the 'Emergency Stop' is false, the case structure doesn't execute and the program continues on its merry way. If 'Emergency Stop' is true, the case structure shown in "Block 2" should execute, shut off the power to my signal generators, and send itself into an infinite loop until someone tells it to stop.
The mechanical action is set to "switch when pressed" so it should not reset once the state is read, however, for some reason the state of the button just resets after pressing it (usually with a 1-2 second delay), the case structure to turn everything off is never executed, and the program just keeps on running.
I have tried both with and without the shift registers shown in "Block 1".
The only thing left I can see that I haven't tried is to move the button itself up a level so that it is the front panel of "Block 1" that is called, rather than "Block 2", that I use for the button.
Any advice would be greatly appreciated. If something isn't clear, let me know and I will be happy to try and elaborate.
08-01-2013 10:28 AM
Opps, here are the images.
08-01-2013 10:29 AM - edited 08-01-2013 10:35 AM
Hi Lars,
do you have that "Emergency" button connected to the connector pane? So it receives the "false" value from the shift register in "block 1" and get's reset each time the subVI is called? Controls connected to connector pane receive their values from the calling VI!
THINK DATAFLOW 😄
08-01-2013 10:29 AM - edited 08-01-2013 10:30 AM
Hi Lars,
You didn't attach the images.
Edit - Got in too late, they are there now!
Regards,
Jeff Peacock
Product Support Engineer | LabVIEW R&D | National Instruments
08-01-2013 10:29 AM
Sorry about that, you should see them now!
08-01-2013 10:34 AM
08-01-2013 10:35 AM
"Emergency" button connected to the connector pane? So it receives the false value from the shift register in "block 1" and get's reset each time the subVI is called?"
In have tried the exact same setup, except I deleted the shift registers (and the false boolean constant) entirely, to no avail.
08-01-2013 10:37 AM
However, the default value of the button itself is "false", so maybe it is resetting itself every time it is called even without the shift registers...
08-01-2013 10:38 AM - edited 08-01-2013 10:38 AM
08-01-2013 10:41 AM
Lol, yeah I think that is my problem.
Not shown in block 2, there are (2) 1-second wait timers in there, maybe if I put the stop function after the wait timers, instead of before, it will give me time to press the button while the program is already called, so it won't just reset on me? For future programs though, I would like to not have to rely on a delay like that... so another solution would be useful.