
1-18 Agilent B1500A/B1505A Programming Guide, Edition 11
Programming Basics
Getting Started
To Read Error Code/Message
If any error occurs, the B1500 will not put the measurement data into the data output
buffer. Hence, confirm that no error has occurred before reading the measurement
data. To read the error code and the error message, enter the ERRX? command.
Example OUTPUT @B1500;"ERRX?"
ENTER @B1500;Code,Msg$
IF Code<>0 THEN
PRINT "ERROR: ";Msg$
ELSE
::
This example checks the error buffer, and prints the error message on the computer
screen if any error code is stored in the error buffer.
ERR? and EMG? commands are also available. These commands support the error
codes 0 to 999.
To Read Spot Measurement Data
After the spot measurements, the B1500 puts the measurement data into its output
data buffer. You can read the data as shown below. The examples read the header
information and the measurement data included in the ASCII data set by the FMT5
command. For the data output format, see “Data Output Format” on page 1-25. The
example uses the HP BASIC or Microsoft Visual Basic .NET language.
Example 1 For the HP BASIC users, use the ENTER statement.
ENTER @B1500 USING "#,3A,12D,X";Head$,Mdata
Example 2 For the VISA library users, use the viScanf, viRead, or another function.
Dim ret_rd As System.Text.StringBuilder = _
New System.Text.StringBuilder(3 + 12 + 1)
ret = viScanf(vi, "%t", ret_rd)
ret_val = ret_rd.ToString()
head = Left(ret_val, 3)
mdata = Val(Mid(ret_val, 4, 12))
Example 3 For the VISA COM library users, use the ReadString or another method.
ret_val = B1500.ReadString(3 + 12 + 1)
head = Left(ret_val, 3)
mdata = Val(Mid(ret_val, 4, 12))
Komentarze do niniejszej Instrukcji