Connecting to a Device
In SenseTalk
- Open a connection to one of these devices.
- Obtain the VISA addresses for your test and measurement devices.
- Check that the correct software is loaded on your Windows machine.
VisaDevice Function
Calling this function is the essential first step in any SCPI script.
Behavior: Opens a connection to a known test and measurement device and returns a VisaDevice object that represents the device.
Parameters: The VISA address of a device, such as one returned by the visaAddresses function. You can use an alias instead of an address. You can assign an alias from within the Keysight Connection Expert program.
Syntax:
visaDevice(deviceAddr)
the visaDevice of "deviceAddr"
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Example:
set deviceAddr to “USB0::)x2A8D::0x0F02::MY56004754::0::INSTR” // Stores the VISA address of a device into the variable 'deviceAddr'
set powerAnalyzer to visaDevice (deviceAddr) // Opens a connection to the VISA device and assigns the VISA device object to the variable 'powerAnalyzer'
Example:
put the visaDevice of “UsbInstrument1” into myInstrument // Opens a connection to the VISA device with the alias "UsbInstrument1" and assigns the VISA device object to the variable 'myInstrument'
Note: The examples use the variables powerAnalyzer and myInstrument. Always use a descriptive variable name for your device.
VisaAddresses Function
Behavior: Obtains a list of the VISA addresses of known test and measurement devices that are configured in the Keysight Connection Expert program. You can then open a connection to one of these devices using the visaDevice function.
Syntax:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Example:
put the VisaAddresses into visaDevices // Stores the list of returned VISA addresses in variable 'visaDevices'.
ST_VISA_Version Function
SenseTalk features that support VISA and SCPI are in an external module (Xmodule) called ST_VISA. To use these features, both the ST_VISA Xmodule and Keysight IO Libraries must be present on your machine.
Behavior: Verifies that the Xmodule and Keysight IO Libraries are installed on the test system, and returns the version number of the Xmodule.
Syntax:
the ST_VISA_Version
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Returns: The current version number of the VISA and SCPI functionality, or an informative message if the module isn’t present or could not be loaded.
Example:
put the ST_VISA_Version // Returns the current version number of the VISA and SCPI functionality