Accessing and Controlling the Device
After opening a device connection using the VisaDevice function, you can update and display certain default settings, or properties, on the test and measurement device to allow you to control it more easily.
On this page:
VisaDevice Properties
Before you start, you can verify that a variable contains a visaDevice connection object using the SenseTalk
set powerAnalyzer to visaDevice(deviceAddr)
put powerAnalyzer is a VisaDevice —> True
The deviceIdentifier Property (Read-Only)
Value: Full identifier string of the device.
Default: Empty.
Behavior: Returns the full identifier string for a test and measurement device.
Examples:
put powerAnalyzer ’s deviceIdentifier —> “Keysight Technologies,N6705C,MY56004754,E.02.03.3189” // Returns the unique ID for the device.
The defaultChannel Property
Value: One or more channels on the device.
Default: Empty.
Behavior: Sets a default channel or set of channels for the device, which simplifies the sequence of commands that you need to address the same channel or channels. This property is very useful for devices that identify individual channels in the form (@2).
Examples:
set powerAnalyzer ’s defaultChannel to 2 // Commands are sent to channel 2 on the device.
set powerAnalyzer.defaultChannel to [1,3] // Commands are sent to channels 1 and 3 on the device.
set the defaultChannel of powerAnalyzer to empty // Resets the default channel on the device.
The defaultIdentifier Property
Value: Identifier for an attribute of the device, for example, a location or group name identifier.
Default: Empty.
Behavior: Sets a default identifier for the device, which simplifies the sequence of commands that use, for example, the same location identifier or group name identifier. The defaultIdentifier is included as a SCPI parameter.
Example:
set defaultIdentifier of powerAnalyzer to "M1.DataOut1" // Sets the default identifier for the device.
set powerAnalyzer ’s defaultIdentifier to 2 // Resets the default identifier for the device.
AllowOverlappedCommands Property
Value: Boolean.
Default: False.
Behavior: Controls whether you can execute overlapping commands. Set the property to:
- False to prevent the parallel execution of commands. SetValue and query commands automatically append ;*OPC? to the end of every SCPI command. This ensures that the command completes before any more messages are sent to the device.
- True (or Yes, or On) to allow operations started by setValue and query commands to run in parallel, by default, on devices which support this capability.
Example:
set AllowOverlappedCommands of powerAnalyzer to True // Allows the parallel execution of commands.
set powerAnalyzer ’s AllowOverlappedCommands to True // Resets the default behavior of the property to prevent the parallel execution of commands.
The ignoreErrors Property
Value: List or range, or combination, of SCPI error numbers.
Default: Empty.
Behavior: Allows you to set a list of SCPI error numbers that will be ignored.
Examples:
set powerAnalyzer’s ignoreErrors to [-420, -800 .. -833] // Adds the listed errors to an ignore list.
insert -502 into the ignoreErrors of powerAnalyzer // Adds the "-502" error to the ignore list.
put empty into powerAnalyzer.ignoreErrors // Clears down the ignore list.
Setting Properties for Multiple Connections
It is possible to open more than one connection to the same device, and then set different properties for each connection. For example, you can create individual connections for each channel on a device.
Example:
set DC1 to visaDevice("DCPower")
set DC1’s defaultChannel to 1 // Opens a connection to the device and sets channel 1 as the default.
set DC2 to visaDevice("DCPower")
set DC2’s defaultChannel to 2 // Opens a connection to the same device and sets channel 2 as the default.
put DC1.query("voltage") // Displays the voltage on channel 1.
put DC2.query("voltage") // Displays the voltage on channel 2.
tell DC2 to SetValue "voltage", DC1.query("voltage") // Sets the voltage on channel 2 to the same as channel 1.