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})

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'

Note: If you store or log the raw SCPI command string that is generated by these functions, you can also send it to the device using the ExecuteSCPI command.

 

This topic was last updated on January 13, 2022, at 02:43:37 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant