04-02-2021 11:05 AM
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.
04-02-2021 12:27 PM
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.
04-04-2021 11:20 AM
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.
04-05-2021 07:26 AM
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.
04-05-2021 11:11 AM
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.