|
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 Operators | Meaning |
? | 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|exp | Matches 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 Expression | Sample Matches |
GPIB?*INSTR | Matches GPIB0::2::INSTR, GPIB1::1::1::INSTR, and GPIB-VXI1::8::INSTR. |
GPIB[0-9]*::?*INSTR | Matches GPIB0::2::INSTR and GPIB1::1::1::INSTR but not GPIB-VXI1::8::INSTR. |
GPIB[^0]::?*INSTR | Matches GPIB1::1::1::INSTR but not GPIB0::2::INSTR or GPIB12::8::INSTR. |
VXI?*INSTR | Matches VXI0::1::INSTR but not GPIB-VXI0::1::INSTR. |
GPIB-VXI?*INSTR | Matches GPIB-VXI0::1::INSTR but not VXI0::1::INSTR. |
?*VXI[0-9]*::?*INSTR | Matches VXI0::1::INSTR and GPIB-VXI0::1::INSTR. |
ASRL[0-9]*::?*INSTR | Matches ASRL1::INSTR but not VXI0::5::INSTR. |
ASRL1+::INSTR | Matches ASRL1::INSTR and ASRL11::INSTR but not ASRL2::INSTR. |
(GPIB|VXI)?*INSTR | Matches GPIB1::5::INSTR and VXI0::3::INSTR but not ASRL2::INSTR. |
(GPIB0|VXI0)::1::INSTR | Matches GPIB0::1::INSTR and VXI0::1::INSTR. |
?*INSTR | Matches all INSTR (device) resources. |
?*VXI[0-9]*::?*MEMACC | Matches 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?*INSTR | Matches 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 Parameter | Meaning |
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.
0 | Canonical 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. | 2 | Aliases 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. | 3 | Include 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. | 4 | Include 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. |
|