LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add timeout for subvi

I have 1 subvi in 1 main program. When there is a trigger signal, the subvi will run, I am wanting to do a timeout for that subvi, when the timeout is over, the subvi will turn off and return to the main program. I have tried FP.close but with no success and the subvi's FP is not turned on because I run in the background. Can anyone help me with the above problem?

Thank all.

Vu_Anh_0-1617379346651.png

Vu_Anh_1-1617379443914.png

 

 

Download All
0 Kudos
Message 1 of 5
(1,466 Views)

You'd have to abort the VI if you have a while loop that never stops. This is not a good way to write code though, you should make it so that it gracefully exits. Event structures have a timeout input already, maybe that would be useful for you.

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

a while loop that never stops it is just an example, actually my loop is a loop to process, when the subvi runs, it will process in that while loop. If it is, the subvi will take less than 1s to process and I will exit back to the main program. But there are cases where the subvi handles up to 10s, I don't want that to happen, so I plan to do a timeout for the subvi. I don't know what to do with event structer in my subvi.

0 Kudos
Message 3 of 5
(1,370 Views)

Move your timer into your processing loop.  If the time expired or you have no more data, stop the loop, causing the VI to complete.


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
0 Kudos
Message 4 of 5
(1,331 Views)

I want to interrupt when the processing loop is processing so I leave the timer on another loop. My processing loop has cases that exceed the expected time so I want to do a timeout for that processing loop.

0 Kudos
Message 5 of 5
(1,322 Views)