Other topics about Sample Programs
The sample program sets the limit range for Rdc measurement, turns on the Rdc measurement function, and then puts the instrument into trigger wait state. Finally, when you press the Trigger key on the front panel and the instrument completes the measurement cycle, the program retrieves and displays the Rdc measurement and limit test results.
See these topics for this programming:
Retrieving Measurement Results
Retrieving the Results of Rdc Measurement
Sub RdcMeasurement()
'Sample program. This program is given the file name rds.bas and is stored
'on the sample program disk.
'The sample program sets the limit range for Rdc measurement, turns on the Rdc
'measurement function, and then puts the instrument into trigger wait state.
'Finally, when the user presses the [Trigger] key ont he front panel and the
'instrument completes the measurement cycle, the program retrieves and displays
'the Rdc measurement and limit test results.
Dim L_lim As Double
Dim U_lim As Double
Dim Rdc As Double
Dim Rdc_test As Integer
Dim stbStatus As Double
Dim msgString As String
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
'Stores the upper and lower limits for Rdc measurement into the L_lim
'and U_lim variables
L_lim = -5
U_lim = 5
'Sets the data transfer format to ASCII
age4982x.WriteString ":FORM ASC"
' Rdc measurement setting
'Sets the limit range for Rdc measurement value to the range between
'L_lim and U_lim
age4982x.WriteString ":CALC:COMP:RDC:LIM " & L_lim & ", " & U_lim
age4982x.WriteString ":CALC:COMP ON"
age4982x.WriteString ":INIT:CONT ON"
age4982x.WriteString ":SOUR:LIST:RDC ON"
' Trigger source setting
'After measurement is stopped (the strigger system is stopped), the
'program sets the trigger source to External trigger and turns on the
'continuous activation of the trigger system
age4982x.WriteString ":ABOR"
age4982x.WriteString ":TRIG:SOUR MAN"
age4982x.WriteString ":INIT:CONT ON"
' Status register setting (For SRQ)
'Instructs the instrument to generate an SRQ upon completion of
'measurement and clears the status byte register and operation status
'event register
age4982x.WriteString ":STAT:OPER:PTR 0"
age4982x.WriteString ":STAT:OPER:NTR 16"
age4982x.WriteString ":STAT:OPER:ENAB 16"
age4982x.WriteString "*SRE 128"
age4982x.WriteString "*CLS"
age4982x.WriteString "*OPC?"
stbStatus = age4982x.ReadNumber
' Triggering and data read
'Prompts the user to press the [Trigger] key. The program waits until
'the user presses [Trigger] key and the instrument completes the
'measurement cycle
MsgBox "Push Trigger Key!", vbOKOnly
Do
age4982x.WriteString "*STB?"
stbStatus = age4982x.ReadNumber
Loop Until stbStatus = 192
'Retrieves the Rdc measurement result and stores it into the
'Rdc variable
age4982x.WriteString ":DATA:RDC?"
Rdc = age4982x.ReadNumber
'Retrieves the Rdc measurement limit test result and stores it into the
'Rdc_test variable
age4982x.WriteString ":CALC:COMP:DATA:RDC?"
Rdc_test = age4982x.ReadNumber
' Display results
'Displays the Rdc measurement value as well as the Rdc measurement
'limit test results
If Rdc_test = 1 Then
msgString = " (LIMIT IN)"
Else
msgString = " (LIMIT OUT)"
End If
MsgBox "Rdc measurement value: " & Rdc & " ohm" & msgString, vbOKOnly
End Sub