08-31-2007 03:48 PM
09-02-2007 09:49 PM - edited 09-02-2007 09:49 PM
mbd
I am not so sure how do you control the instr, but there is some related stuff about the operation procedure http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/c90d20f3a89871c2862569970073d282?O... , I do not think it is very good to dispose the resource after an action, if it is a long process control, you can keep handle the session for a long time, I do not know why you need to use two applications (instance) to communicate to a single instr.
I met several threads about this error, most of them were solved by update the VISA version, http://forums.ni.com/ni/board/message?board.id=170&message.id=85017&requireLogin=False
帖子被paulbin在09-02-2007 09:51 PM时编辑过了
09-04-2007 02:41 PM
09-04-2007 02:58 PM
09-04-2007 03:11 PM
Multiple Applications Using the NI-VISA Driver
Multiple-application support is an important feature in all implementations
of theNI-VISA driver.You can have several applications that useNI-VISA
running simultaneously. You can even have multiple instances of the same
application that uses the NI-VISA driver running simultaneously, if your
application is designed for this. The NI-VISA operations perform in the
same manner whether you have only one application or several applications
(or several instances of an application) all trying to use the NI-VISA driver.
However, you need to be careful when you have multiple applications or
sessions using the low-level bus access functions. The memory windows
used to access the bus are a limited resource. Call the
viMapAddress()operation before attempting to perform low-level bus access with
viPeek
XX() or viPokeXX(). Immediately after the accesses arecompleted, always call the
viUnmapAddress() operation so that you freeup the memory window for other applications.
09-10-2007 11:54 AM
09-10-2007 01:58 PM - edited 09-10-2007 01:58 PM
Message Edited by mbd on 09-10-2007 02:08 PM
09-11-2007 09:31 AM
Hi,
This problem seems to get more and more ambiguous. You have not made it very clear as to what your program does and how you are trying to control your instruments. Please see the following links, hopefully one of these will imply to your application, if not, then please write back with more details about program.
http://digital.ni.com/public.nsf/allkb/DDE6A6A773A4B1DC86256BC0005C8A8F?OpenDocument
http://digital.ni.com/public.nsf/allkb/D2084EC381319CC386256A1D006F1415?OpenDocument
http://forums.ni.com/ni/board/message?board.id=170&message.id=194794&requireLogin=False
Can you also try running NI-Spy to see what error messages it records.
Thanks,
Arjun K
09-11-2007 10:10 AM
Multiple Applications Using the NI-VISA Driver
Multiple-application support is an important feature in all implementations
of theNI-VISA driver.You can have several applications that useNI-VISA
running simultaneously. You can even have multiple instances of the same
application that uses the NI-VISA driver running simultaneously, if your
application is designed for this. The NI-VISA operations perform in the
same manner whether you have only one application or several applications
(or several instances of an application) all trying to use the NI-VISA driver.
However, you need to be careful when you have multiple applications or
sessions using the low-level bus access functions. The memory windows
used to access the bus are a limited resource. Call the
viMapAddress()operation before attempting to perform low-level bus access with
viPeek
XX() or viPokeXX(). Immediately after the accesses arecompleted, always call the
viUnmapAddress() operation so that you freeup the memory window for other applications.
iEGpibDevice.Connect(txtInstrument.Text);
iEGpibDevice.Write(txtInstrument.Text,
"APPLy 9.5,1.5");iEGpibDevice.Write(txtInstrument.Text,
"OUTPut OFF");iEGpibDevice.Disconnect();
--------
Below is the code inside the function of Write and Connect
public void Write(string instrument, string command){
if (mbs != null){
mbs.Write(command);
}
}
public void Connect(string instrument)
{
try{
if (mbs == null){
mbs =
new MessageBasedSession(instrument,AccessModes.NoLock,2500);}
} catch (InvalidCastException){
throw new ApplicationException("Resource selected must be a messaged-based session");}
catch (Exception ex){
throw new ApplicationException(ex.Message.ToString());}
}
09-11-2007 03:37 PM