62
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
3
Getting Started
Reading Query Results into String Variables
The output of the instrument may be numeric or character data depending on
what is queried. Refer to the specific command descriptions for the formats and
types of data returned from queries.
The following example shows numeric data being returned to a string variable:
myScope.WriteString ":CHANnel1:RANGe?"
Dim strQueryResult As String
strQueryResult = myScope.ReadString
MsgBox "Range (string):" + strQueryResult
After running this program, the controller displays:
Range (string): +40.0E+00
Reading Query Results into Numeric Variables
The following example shows numeric data being returned to a numeric variable:
myScope.WriteString ":CHANnel1:RANGe?"
Dim varQueryResult As Variant
varQueryResult = myScope.ReadNumber
MsgBox "Range (variant):" + CStr(varQueryResult)
After running this program, the controller displays:
Range (variant): 40
Reading Definite-Length Block Query Response Data
Definite-length block query response data allows any type of device-dependent
data to be transmitted over the system interface as a series of 8-bit binary data
bytes. This is particularly useful for sending large quantities of data or 8-bit
extended ASCII codes. The syntax is a pound sign (#) followed by a non-zero digit
representing the number of digits in the decimal integer. After the non-zero digit is
the decimal integer that states the number of 8-bit data bytes being sent. This is
followed by the actual data.
For example, for transmitting 1000 bytes of data, the syntax would be:
NOTE
Express String Variables Using Exact Syntax
In Visual Basic, string variables are case sensitive and must be expressed exactly the same
each time they are used.