09-06-2007 04:04 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.
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());}
}
Can someone clarify this? Thanks in advance!!!
09-11-2007 05:10 PM