Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

VISA Find Resource Function

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Owning Palette: VISA Advanced VIs and Functions

Requires: Base Development System

Queries the system to locate the devices associated with a specified interface.

Details  

expression matches the value specified with the devices available for a particular interface. The description string specified sets the criteria to search an interface—GPIB, GPIB-VXI, VXI, All VXI, Serial, or All—for existing devices. The following table includes valid special characters and operators.
Special Characters and OperatorsMeaning
?Matches any one character.
\Makes the character that follows it an ordinary character instead of special character. For example, when a question mark follows a backslash (\?), it matches the ? character instead of any one character.
[list]Matches any one character from the enclosed list. You can use a hyphen to match a range of characters.
[^list]Matches any character not in the enclosed list. You can use a hyphen to match a range of characters.
*Matches 0 or more occurrences of the preceding character or expression.
+Matches 1 or more occurrences of the preceding character or expression.
Exp|expMatches either the preceding or following expression. The or operator | matches the entire expression that precedes or follows it and not just the character that precedes or follows it. For example, VXI|GPIB means (VXI)|(GPIB), not VX(I|G)PIB.
(exp)Grouping characters or expressions.
The search criteria specified in the expression parameter has two parts, a regular expression over a resource string and an optional logical expression over attribute values. The regular expression is matched against the resource strings of resources known to the VISA Resource Manager. If the resource string matches the regular expression, the attribute values of the resource are matched against the expression over attribute values. If the match is successful, the resource has met the search criteria and is added to the list of resources found. The following table includes valid regular expressions.
Regular ExpressionSample Matches
GPIB?*INSTRMatches GPIB0::2::INSTR, GPIB1::1::1::INSTR, and GPIB-VXI1::8::INSTR.
GPIB[0-9]*::?*INSTRMatches GPIB0::2::INSTR and GPIB1::1::1::INSTR but not GPIB-VXI1::8::INSTR.
GPIB[^0]::?*INSTRMatches GPIB1::1::1::INSTR but not GPIB0::2::INSTR or GPIB12::8::INSTR.
VXI?*INSTRMatches VXI0::1::INSTR but not GPIB-VXI0::1::INSTR.
GPIB-VXI?*INSTRMatches GPIB-VXI0::1::INSTR but not VXI0::1::INSTR.
?*VXI[0-9]*::?*INSTRMatches VXI0::1::INSTR and GPIB-VXI0::1::INSTR.
ASRL[0-9]*::?*INSTRMatches ASRL1::INSTR but not VXI0::5::INSTR.
ASRL1+::INSTRMatches ASRL1::INSTR and ASRL11::INSTR but not ASRL2::INSTR.
(GPIB|VXI)?*INSTRMatches GPIB1::5::INSTR and VXI0::3::INSTR but not ASRL2::INSTR.
(GPIB0|VXI0)::1::INSTRMatches GPIB0::1::INSTR and VXI0::1::INSTR.
?*INSTRMatches all INSTR (device) resources.
?*VXI[0-9]*::?*MEMACCMatches VXI0::MEMACC and GPIB-VXI1::MEMACC.
VXI0::?*Matches VXI0::1::INSTR, VXI0::2::INSTR, and VXI0::MEMACC.
?*(default) Matches all resources.
visa://hostname/?*Matches all resources on the specified remote system. You can set the hostname as either an IP address (dot-notation) or a network machine name. This remote system does not need to be a configured remote system.
/?*Matches all resources on the local machine. Does not query configured remote systems.
visa:/ASRL?*INSTRMatches all ASRL resources on the local machine and returns them in URL format, such as visa:/ASRL1::INSTR.
By using the optional attribute expression, you can construct flexible and powerful expressions with the use of logical ANDs (&&), ORs(||), and NOTs (!). You can use equal (==) and unequal (!=) comparators to compare attributes of any data type, and other inequality comparators (>, <, >=, <=) to compare attributes of numeric data type. Use only global attributes in the attribute expression. Local attributes are not allowed in the logical expression part of the expr parameter. The following table includes valid expression parameters.
Expr ParameterMeaning
GPIB[0-9]*::?*::?*::INSTR{VI_ATTR_GPIB_SECONDARY_ADDR > 0 && VI_ATTR_GPIB_SECONDARY_ADDR < 10}Find all GPIB devices that have secondary addresses from 1 to 9.
ASRL?*INSTR{VI_ATTR_ASRL_BAUD == 9600}Find all serial ports configured at 9600 baud.
?*VXI?INSTR{VI_ATTR_MANF_ID == 0xFF6 && !(VI_ATTR_VXI_LA ==0 || VI_ATTR_SLOT <= 0)}Find all VXI instrument resources having manufacturer ID FF6 and which are not logical address 0, slot 0, or external controllers.
search mode determines how the function returns found interfaces in the find list output, either by canonical names or aliases. The default is 0.
This input accepts the following values.

0Canonical Names Only—Search all configured buses. Returns only the resources found that match the expression string. The format of each returned string is the VISA canonical spec-defined resource format.
2Aliases Only—Search all configured buses. Returns only the resources found that match the expression string. For each resource, if there is a user-defined alias for that resource, that alias is returned. For the other resources, the returned string is in the VISA canonical spec-defined resource format.
3Include Matching Aliases—Do not search any buses. Returns only resources with user-defined aliases. The only valid expression string is "?*". The format of each returned string is an alias.
4Include All Aliases—Search all configured buses. Returns all found resources that match the expression string and all user-defined aliases even if they do not match the expression string. For each resource, the function returns a user-defined alias if there is one for that resource. For the other resources, the returned string is in the VISA canonical spec-defined resource format.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
find list is an array of strings, each string specifying one interface found by the function.
return count specifies the number of matches found. The number of matches found is the number of strings in the find list array.
error out contains error information. This output provides standard error out functionality.

VISA Find Resource Details

LabVIEW lists resources in an I/O control according to the chosen I/O control class type and the Filter VISA Names dialog box, so you might not need to call this function.

All resource strings returned by this function are recognized by VISA Open. However, this function does not necessarily return all strings that you pass to the VISA Open function. This is especially true for network and TCP/IP resources. If a resource does not appear in the list, you can explicitly add the resource in the NI-VISA configuration utility, such as (Windows) Measurement & Automation Explorer, (Linux) visaconf, or (Mac OS X) NI-VISA Configuration. The configuration utility also has options that expand or limit the set of resources that this VI returns.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit