05-21-2020 01:43 AM
I have a labview VI in which there is data coming from COM port, and intially user is asked to set com port.
There is EXIT button on the VI, which when pressed, safely exits the code, and close the com port. If user do this then when next time VI start again then no issues come.
Issue arises, if instead of safe EXIT , user user "Cross Close button" on top right of all window dialogs or end task from task manager, then what happend it COM port dont get freed, I suppose.
On next rerun of VI, even if user is able to select the COM port but no data is received, unless VI is closed, usb port is disconnected and connected again.
Whats the solution for this.
05-21-2020 04:55 AM
I use an Event Structure to handle the closing of the VI panel (Panel Close filter event). I use the filter event so I can discard the closing, perform all of the clean up, and then close the panel myself (if in an executable).
05-21-2020 05:02 AM
Hi,
Perform the below mentioned steps.
05-21-2020 05:35 AM
@crossrulz thanks for your reply.
Can you show one example or sample?
05-21-2020 05:58 AM - edited 05-21-2020 06:03 AM
@Vindhyachal.Takniki wrote:
@crossrulz thanks for your reply.
Can you show one example or sample?
Slight editing from a VI I showed at VIWeek:
05-21-2020 09:25 AM
kartiknattar@ospl.in wrote:
Hi,
Perform the below mentioned steps.
- Select Tools » Options to display the Options dialog box.
- Select Environment from the Category list.
- Check the Automatically Close VISA Sessions checkbox
- Select OK
While this will probably solve the problem the OP is having.
The automatically closing VISA sessions option is NOT a replacement for proper programming!
05-21-2020 10:49 AM
@RTSLVU wrote:
kartiknattar@ospl.in wrote:
Hi,
Perform the below mentioned steps.
- Select Tools » Options to display the Options dialog box.
- Select Environment from the Category list.
- Check the Automatically Close VISA Sessions checkbox
- Select OK
While this will probably solve the problem the OP is having.
The automatically closing VISA sessions option is NOT a replacement for proper programming!
This may fix the immediate problem, but not the ultimate problem. I generally don't even include a STOP button on my front panels any more (at least with the Exit the program context - I might have a button to stop a particular task). In my opinion the introduction of the Event Structure and the Panel Close? filter event may very well be the greatest innovation in LabVIEW since it's first introduction (and that includes the switch from Traditional DAQ to DAQmx). No more polling.Better control of the program.
05-21-2020 11:55 AM
@RTSLVU wrote:
kartiknattar@ospl.in wrote:
Hi,
Perform the below mentioned steps.
- Select Tools » Options to display the Options dialog box.
- Select Environment from the Category list.
- Check the Automatically Close VISA Sessions checkbox
- Select OK
While this will probably solve the problem the OP is having.
The automatically closing VISA sessions option is NOT a replacement for proper programming!
While I agree that shutting down properly should be handled (ie handling the panel close), it still does not handle the "end task from task manager" case. Does LabVIEW release the handle after exiting out of LabVIEW?
05-21-2020 12:07 PM - edited 05-21-2020 12:10 PM
@Frozen wrote:
@RTSLVU wrote:
kartiknattar@ospl.in wrote:
Hi,
Perform the below mentioned steps.
- Select Tools » Options to display the Options dialog box.
- Select Environment from the Category list.
- Check the Automatically Close VISA Sessions checkbox
- Select OK
While this will probably solve the problem the OP is having.
The automatically closing VISA sessions option is NOT a replacement for proper programming!
While I agree that shutting down properly should be handled (ie handling the panel close), it still does not handle the "end task from task manager" case. Does LabVIEW release the handle after exiting out of LabVIEW?
I have found that the development environment indeed does. But if a compiled program is aborted through Ctl+Alt+Del and you kill the process with Task Manager there is no guarantee even with "Automatically Close VISA sessions" enabled.
As the program has to properly exit for that to occur automagically...
04-09-2021 08:22 AM
could you please share your LabVIEW file