The Resource Manager

NI-VISA

The Resource Manager

The Communication Channels: Sessions topic briefly mentioned the VISA Resource known as the Resource Manager. What exactly is a Resource Manager? If you have worked with VXI, you are familiar with the VXI Resource Manager. Its job is to search the VXI chassis for instruments, configure them, and then return its findings to the user. The VISA Resource Manager has a similar function. It scans the system to find all the devices connected to it through the various interface buses and then controls the access to them. Notice that the Resource Manager simply keeps track of the resources and creates sessions to them as requested. You do not go through the Resource Manager with every operation defined on a resource.

Again referring to the message-based communication example, notice that the first line of code is a function call to get a session to the Default Resource Manager:

status = viOpenDefaultRM(&defaultRM);

The viOpenDefaultRM() function returns a unique session to the Default Resource Manager, but does not require some other session to operate. Therefore, this function is not a part of any resource—not even the Resource Manager Resource. It is provided by the VISA driver itself and is the means by which the driver is initialized.

Now that you have a communication channel (session) to the Resource Manager, you can ask it to create sessions to instruments for you. In addition to this, VISA also defines operations that can be invoked to query the Resource Manager about other resources it knows about. You can use the viFindRsrc() operation to give the Resource Manager a search string, known as a regular expression, for instruments in the system. See Initializing Your VISA Application for more information about viFindRsrc().