Specifications

Chapter 18 547
COM Interface Reference
How to read array data
18. COM Interface Reference
When the data type is string:
Example 18-24 Specifying option parameters “*” and “#”
Assume there are returned values ("Agilent, E4991A, 113,1.0") from "SCPI.Output
"*IDN?" kept in the queue. The method used to read the 2nd data item ("E4991A")
divided with commas (,) and empty the queue is as follows.
Dim Val as String
SCPI.Output "*IDN?"
SCPI.Enter Val, "#"
SCPI.Enter Val, "#"
SCPI.Enter Val, "*"
When "SCPI.Enter Val, "#" is executed, the first data item only is read and substituted
into Val (Val = "Agilent"). At this point, the 2nd data onward ("E4991A, 113,1.0") still
remain in the queue.
Next, when "SCPI.Enter Val, "#" is executed, the first data item only is read and
substituted into Val (Val = "E4991A"). At this point, the 3rd data onward ("113,1.0")
still remain in the queue.
Finally, when "SCPI.Enter Val, "*" is executed, all of the data is cancelled and the
queue becomes empty. At this point, Val = "E4991A" remains the same.
When the data type is variant:
It is possible to read the data divided with commas (,) as a string array by specifying
"#" as the option parameter and executing the command. Refer to
Example 18-25 for
details.
Aim: Reading the entire data (array data) separated with commas.
To read all of the comma (,) separated data (array data), specify the data type of the
variable as variant.
Example 18-25 Specifying option parameter “#”
Assume there are returned values ("1,2,3,4") of "SCPI.Output "DATA:RAW?" kept in the
queue.
Dim Val as Variant
SCPI.Output "DATA:RAW?"
SCPI.Enter Val, "#"
When "SCPI.Enter Val, "#" is executed, all of the data is read in the form of a string array
and substituted into Val (Val (0)=1, Val (1)=2, Val (2)=3 and Val (3)=4). At this point, the
queue becomes empty.