Discussion:
viFindRsrc opens & closes my virtual COM port, but viOpen returns VI_ERROR_RSRC_BUSY
(too old to reply)
Believer
2007-03-30 23:40:13 UTC
Permalink
Hello,
 
I have a virtual serial COM port which quite happily shows up in MAX as ASRL5::INSTR.
I can also open a HyperTerminal session to it.
 
When I do a viFindRsrc, my 'Open' routine of my virtual COM port gets called, followed by the 'Close' routine.
So I know that VISA can open and close the device. Great.
This is also what happens when I open the HyperTerminal session.
 
However when I try a viOpen with the string that viFindRsrc gave me ("ASRL5::INSTR"),
VISA returns with VI_ERROR_RSRC_BUSY.
 
Nevertheless I can then open a HyperTerminal session (which calls my 'Open' routine)
and do a find with MAX which does the same thing.
 
Please don't tell me that another piece of software has the COM port already open or busy.
If vIFindRsrc can open it and close it - or HyperTerminal, then I would like to be able to do the same thing with viOpen.
Changing the AccessMode for viOpen gives me no success.
 
I have VISA 3.6 and am running XP with SP2
 
So the bottom line? viFindRsrc opens & closes my port, but viOpen returns VI_ERROR_RSRC_BUSY.
 
Any help would be much appreciated.
 
Thanks.
Makoto
2007-04-04 00:40:12 UTC
Permalink
When you call viClose() for a valid VISA session requires that you already have the session (ViSession) acquired from a successful viOpen().  Passing an invalid session to viClose() just generates an error.
But there is another viClose() call concerning viFindRsrc().  If you have called viFindRsrc() and viFindNext(), you must close the "find list" session acquired from viFindRsrc().  Likely forgetting viClose() for this situation may prevent to open the COM port.
Believer
2007-04-04 16:10:17 UTC
Permalink
"Likely forgetting viClose() for this situation may prevent to open the COM port.".
Yes - and I had checked this especially.
So I can run my routine with the viFindRsrc in it over and over, and each time it will faithfully open and close my COM port.
When viFindRsrc is called, NI SPY logs this as viFindRsrc and the breakpoint for objVPort_OnOpened() is hit in my virtual COM port followed by objVPort_OnClosed(). This all takes places for one viFindRsrc call logged on one line of SPY.exe.
I'd love to know what the source code for viFindRsrc is, because I think it must not use viOpen to do it's "Open".
Does anyone know the inner workings of viFindRsrc? Could someone from NI shed some light on this please?
 
 

Loading...