01-31-2007 01:28 PM
02-02-2007 03:06 AM
02-02-2007 10:44 AM
Hello Jason,
I figured something like that; normally I will close the session but when things crash or processes are killed I don't have the opportunity. Before I didn't see how I could get the session pointer without creating a new one but I'll look at the NI API more thoroughly now.
Thanks,
Jeff
02-05-2007 12:39 PM
No luck in figuring out how to get the SerialSession pointer without calling new (which gives the exception). Any idea on how to do this?
Thanks,
Jeff
02-06-2007
06:44 PM
- last edited on
07-10-2025
12:56 PM
by
Content Cleaner
Hey Jeff,
If I understand what you are asking correctly, I believe this knowledge base will answer your question. Make sure you take a look at the attached pictures.
Hope this helps!
Regards,
Jason W
Applications Engineer
National Instruments
02-06-2007 06:59 PM
Hello Jason,
Sorry I didn't see any relevant information in the knowledge base article because
1) I can't close the session programmatically if the module crashes.
2) Unlike the article the port really isn't in use since I can, subsequent to the exception, open it in Hyperterminal or NI's Explorer.
3) Maybe what the picture shows is some way to enumerate all the in-use Visa port sessions. If so I need to know what API to call to do this in C# (preferably) or C/C++.
Another way to phrase the question is how and why NI's explorer can open the port and my C# code can't? Maybe this is due to a limitation in Visa's C# implementation and I need to call some Visa C API?
This is very important for my project because the alternative of restarting the OS will reset all the USB devices which is highly undesirable.
Thanks,
Jeff
02-08-2007 09:56 PM
02-09-2007 12:55 PM
Hello Jason,
The VisaNS dll is version 8.0.20.177
NI-Visa 3.6
visa32.dll 3.6.0.49153
nivisaserver.exe 3.6.0.49152
nivisaic.exe 3.6.0.49152
HTH,
Jeff
02-12-2007
01:23 PM
- last edited on
07-10-2025
12:56 PM
by
Content Cleaner
Hey Jeff,
Something I would recommend is updating your VISA driver from 3.6 to 4.0. You can download the latest driver here.
The new driver may have improved coding to deal with crashes in the middle of a program by a crash, or an abort.
Are you able to replicate this with a simple program? I opened an example program in labVIEW and did an abort in the middle of a serial write session, and then as long as I ran it again, and made sure to close the VISA session everything was fine. I know you're programming in C++, but the driver function calls should be the same. I am using VISA 4.0, so it may be as simple as a driver upgrade that will solve this problem.
Can you let me know if that helped?
Good luck!
Nick D.
02-12-2007 01:50 PM
Hello Nick,
I'll try updating to VISA version 4 this afternoon and see if it works.
One problem I have is how can I close the Visa session when rerunning my module as you are doing in LabVIEW? Normally I need a pointer (actually reference) to the session in order to call the close function. I suspect there must be some low level close function, probably in C, that I can call to close.
Another possibility is that this is a C# bug, and that the Visa session is really closed but some NI module has a variable that says it wasn't closed. This would explain why I can still open the port using NI's Explorer or Hyperterminal.
Jeff