Debugging Your Code
The commands and functions described in this section allow you to:
- Log information about commands that are sent to a device to the console.
- Try out SCPI commands before they are sent to a device.
The VISADebug Global Property
Values: On or Off
Default: Off
Behavior:Logs information about commands that you are sending to a device to the console. Switch on this property for debugging purposes, and to understand the way that commands are interpreted.
Example:
set the VISADebug to On // Logs device commands to a console.
MakeSCPICommand, MakeSCPIQuery Functions
Behavior: Generates a SCPI command string without sending it to the device. This is useful for testing how different combinations of user-friendly command strings and parameters are sent for the setValue or query functions, respectively. These functions use the current device settings, from the VisaDevice properties:
- DefaultChannel
- DefaultIdentifier
- AllowOverlappedCommand.
Parameters: Supported SCPI parameters.
Syntax:
makeSCPICommand("command text"{,value})
makeSCPIQuery("query text"{,value})
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: Binary data for the specific SCPI command.
Example:
put powerAnalyzer.makeSCPICommand("voltage on channel 2", 500 millivolts)
—> VOLTAGE 0.5, (@2);*OPC?
put powerAnalyzer.makeSCPIQuery("measure voltage for M1.DataOut1 allow overlap")
—> MEASURE:VOLTAGE? 'M1.DataOut1'