02-23-2023 06:51 AM
1. it is a real RS232 DB9 port mounted on the main board of one industry computer, not USB-RS232.
2. The LabVIEW error code is -107380246 showed on my first picture.
3. I failed to find the function "Close VISA session automatically", only found "VISA Close" in LabVIEW 2014.
02-23-2023 07:07 AM
@AeroSoul wrote:
If you can close the port with putty or similar, then you can probably make batch script that you call with LabVIEW before opening the port.
Content of batchscript:
cd C:\Program Files (x86)\PuTTY (path to putty on your system, this is on mine)
putty.exe -serial COM#
taskkill /IM putty.exe /F (/F to force close it, otherwise you need to click OK)
Have you tried this, from my previous post?
The Close VISA session automatically can be found in Getting started window (View-->Getting Started Window..-->Tools-->Options...-->Environment-->Automatically Close VISA Sessions), but that probably won't help you here.
02-23-2023 07:15 PM
Thank you AeroSoul.
I have tried some ways to open and close the com port successfully including the following serial port assistant which should be similar with Putty.exe. Then start my LabVIEW EXE to open the com port failed.
02-24-2023 03:51 AM
This is LabVIEW problem because other program language can open ok.
02-24-2023 04:34 AM
changelopnur, you confuse us.
First it was a USB port. Later you wrote, it's an RS232 port. RS232 ports are not listed as USB:: in NI MAX. Next, the error in the first picture was not from opening the COM port, it was from the configuration via property node. So if that real RS232 port is COM6, which I currently doubt, you would open it as COM6 or perhaps by its ASRLx::INSTR resource string. When opening the COM6 with VISA Open, another error should come up or none at all.
Regarding item 3: LabVIEW option "Close VISA sessions automatically", not function or VI.
02-24-2023 05:02 AM
@MaSta,
I never said it was a USB port. The COM6 is one RS232 DB9 port mounted on the main board of industry computer.
Always, I first set the com port using VISA Configure Serial Port (Instr).vi(I mean open the com6), then I can use VISA write and VISA read.
I also tried first use VISA Open function to open COM6, failed the same.
02-24-2023 05:24 AM
@MaSta,
Do you mean I first active the option "Close VISA sessions automatically", then build my EXE?
BTW, this problem is present only at forcing close the C++ software which is calling one LabVIEW DLL for operating COM6 without closing .
So I need to active the option "Close VISA sessions automatically", then build the DLL?
02-24-2023 09:58 AM
You might have luck with restarting the COM-Port driver:
02-24-2023 12:16 PM
This all sounds very strange to me.
Are you sure, that you get the same error message in all cases?
Up to now, we do not know, what the C++DLL is doing and we do not know, what VISA and other programs doing. It may have something to do with access levels/shared access. I never tried to configure the serial port for shared access - it makes simply no sense. So I don't know if this works or not.
I would like to know how my shared library acts in your situation. I just call the DLL directly, because I have no LabVIEW 14 version available. Please execute the attached VI. It's doing nothing special. Just opening the serial port with read/write access and then closing the serial port. It should be very similar to what other programs are doing.
02-28-2023 11:57 PM
@MaSta,
Active the option "Close VISA sessions automatically", built the DLL.It doesn't work, the problem is the same.