Retrieving Results Using :READ?

Other topics about Sample Program

Overview

This sample program retrieves and displays the measurement status, the measurement results for parameters 1 and 2, and the result of test signal current level monitoring when the instrument receives an external trigger and completes the measurement cycle.

See these topics for this programming:

Sample Program in Excel VBA Using VISA-COMSub Read()

    'Using the :READ? command to retrieve measurement results

    

    Dim Para1 As String

    Dim Para2 As String

    Dim Poin As Integer

    Dim ReadData() As Double

    Dim ioMgr As VisaComLib.ResourceManager

    Dim age4982x As VisaComLib.FormattedIO488

    

    ' Sets the GPIB address

    Set ioMgr = New VisaComLib.ResourceManager

    Set age4982x = New VisaComLib.FormattedIO488

    Set age4982x.IO = ioMgr.Open("GPIB0::17::INSTR")

    age4982x.IO.Timeout = 30000

    

    'Sets the Point variable to the number of measurement points for single-point measurement

    Poin = 1

    

    'Sets the data transfer format to ASCII

    age4982x.WriteString ":FORM ASC", True

    

    'Instructs the instrument to show the results for measurement

    'parameters 1 and 2 as well as the result of test signal current level

    'monitoring while hiding the measurement results of measurement

    'parameters 3 and 4 as well as the result of test signal voltage level

    'monitoring

    age4982x.WriteString ":DISP:TEXT1:CALC1 ON", True

    age4982x.WriteString ":DISP:TEXT1:CALC2 ON", True

    age4982x.WriteString ":DISP:TEXT1:CALC3 OFF", True

    age4982x.WriteString ":DISP:TEXT1:CALC4 OFF", True

    age4982x.WriteString ":DISP:TEXT1:CALC11 ON", True

    age4982x.WriteString ":DISP:TEXT1:CALC12 OFF", True

    

    'Retrieves the parameter names of measurement parameters 1 and 2

    'and stores the names into Para1 and Para2 variables, respectively

    age4982x.WriteString ":CALC:PAR1:FORM?", True

    Para1 = age4982x.ReadString

    age4982x.WriteString ":CALC:PAR2:FORM?", True

    Para2 = age4982x.ReadString

    

    'Instructs the instrument to perform single-point measurement at the

    'point identified by the Poin variable

    age4982x.WriteString ":SOUR:LIST:STAT OFF", True

    age4982x.WriteString ":SOUR:LIST:POIN " & Poin, True

    

    'Turns off the bin sorting and Rdc measurement functions

    age4982x.WriteString ":CALC:COMP OFF", True

    age4982x.WriteString ":SOUR:LIST:RDC OFF", True

    

    ' Trigger source setting

    'After the measuremnt is stopped (the trigger system is stopped), the

    'program sets the trigger source to Manual trigger

    age4982x.WriteString ":ABOR", True

    age4982x.WriteString ":TRIG:SOUR MAN", True

    

    ' Triggering and data read

    'After issuing the :READ? command, the program prompts the user to

    'input a manual trigger. The program waits until the instrument

    'receives a manual trigger and completes the measurement cycle

    age4982x.WriteString ":READ?", True

    MsgBox "Please press the Trigger key on the front panel", vbOKOnly

    

    'Retrieves the measurement status, the measurement results for

    'parameters 1 and 2 and the result of test signal current level monitoring,

    'then stores it into ReadData array

    ReadData() = age4982x.ReadList(ASCIIType_R8, ",")

       

    ' Display results

    'Displays the measurement results

    MsgBox "Meas Status:" & ReadData(0) & vbCr & "Parameter 1: " & Para1 & "Result: " & ReadData(1) & vbCr _

    & "Parameter 2: " & Para2 & "Result: " & ReadData(2) & vbCr & "Imon: " & ReadData(3), vbOKOnly

End Sub