From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo 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: 

Strange behavior when shutting down - only works once

Hi there,

 

I'm taking advice from around the forum to create a shutdown button for my VI. When the user sends the shutdown command, the loop stops all processes running and turns off all heaters. Then when this is complete it passes a shutdown variable to all loops allowing them to close. This seems to work perfectly once, but when I hit run again and test it again, it fails. If I abort the VI and restart again, the shutdown works. I can't quite figure out what the behavior is doing here.

 

Attached is my program, it's a little messy but everything works, and it has to be added to by someone who isn't me, so I tried to keep everything clear and seperate. If anyone's got any ideas as to what is causing this strange behavior I'd love to hear it.

 

Thanks,

Chris.

0 Kudos
Message 1 of 5
(2,301 Views)

You need to read the button in the event case that handles its value change to reset the button state for next time.

 

0 Kudos
Message 2 of 5
(2,296 Views)

On first call I'm turning the shutdown variable to false. I thought that would take care of it. Is that not true?

0 Kudos
Message 3 of 5
(2,290 Views)

@Chris Johnson wrote:

On first call I'm turning the shutdown variable to false. I thought that would take care of it. Is that not true?


Your shutdown variable is a different entity to the "Shutdown PB" button, so no, that won't do the job. 

 

 

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

First of all, your event loop should look something more like this.  Otherwise you won't exit the loop until another event comes through.

 

Secondly, I think you are writing to the wrong control here (this is in your timed loop).  I have no clue what is in the subVI, but I don't think it should be looking at the Shutdown PB control.  That control should be in it's event case.  But here you are trying to cause the shutdown event, but you are writing to the wrong control.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 5 of 5
(2,280 Views)