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.
VisaDevice Properties
Before you start, you can verify that a variable contains a visaDevice
connection object using the SenseTalk is a
operator.
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)
.
You can use the defaultChannel
property with the setValue
and query
commands, but not the perform
, queryData
and ExecuteSCPI
commands.
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.
You can override the defaultChannel
value for an individual SCPI message by specifying on channel <channel>
in that command. See Special Phrases for full details.
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.
You can use the defaultIdentifier
property with the setValue
and query
commands, but not
the perform
, queryData
and ExecuteSCPI
commands.
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.
You can override the defaultIdentifier
value for an individual SCPI message by specifying for <identifier>
in that command. See Special Phrases for full details.
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
andquery
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
(orYes
, orOn
) to allow operations started bysetValue
andquery
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.
You can override the AllowOverlappedCommands
value for an individual SCPI message by specifying allow overlap
or no overlap
in that command. See Special Phrases for full details.
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.