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:
set powerAnalyzer to visaDevice(deviceAddr)
put powerAnalyzer is a VisaDevice —> True
Value: Full identifier string of the device.
Behavior: Returns the full identifier string for a test and measurement device.
put powerAnalyzer ’s deviceIdentifier —> “Keysight Technologies,N6705C,MY56004754,E.02.03.3189” // Returns the unique ID for the device.
Value: One or more channels on the device.
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).
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.
Value: Identifier for an attribute of the device, for example, a location or group name identifier.
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.
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.
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.
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.
Value: List or range, or combination, of SCPI error numbers.
Behavior: Allows you to set a list of SCPI error numbers that will be ignored.
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.
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.
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.