
Sample Program
7-11
IM 760151-17E
7
Sample2(GPIB) Get Impedance Data
————————————————————————————————————————————
Private Function GpibImpedance() As Integer
Dim msg As String ‘Command buffer
Dim qry As String ‘Query buffer
Dim sts As Integer
Dim wait As Integer
Dim item As Integer
Dim comma As Integer
Dim length As Integer
Dim cnt As Integer
term = Chr$(10) ‘terminator
msg = Space$(100)
qry = Space$(1200)
List1.AddItem “Now Initializing. Wait a moment.”
Dummy = DoEvents()
sts = InitGpib ‘Initialize GPIB
If (sts <> 0) Then
GpibImpedance = 1
Exit Function
End If
‘Initialize the settings
msg = “*RST” + term ‘Initialize the settings
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Set the measurment condition
‘Mode = impedance mode
msg = “IMPEDANCE:STATE ON” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Superpose Output Ratio = 0.3, Hold Action = Normal
msg = “IMPEDANCE:SUPERPOSE:DETAILE:RATIO 0.3;HOLD NORMAL” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Superpose DC Offset = 1.000, Superpose AC Amp = 1.000
msg = “IMPEDANCE:SUPERPOSE:OFFSET 1;AMPLITUDE 1” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Frequency Range = Hz, Frequency Value = 10
msg = “IMPEDANCE:SUPERPOSE:FREQUENCY:RANGE HZ;VALUE 10” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Hold On
msg = “HOLD ON” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Superpose Output Type = AC/DC, Superpose Output = ON
msg = “IMPEDANCE:SUPERPOSE:OUTPUT:TYPE ACDC;STATE ON” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
‘Initialize voltage range
msg = “IMPEDANCE:VOLTAGE:INITIALIZE” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibImpedance = 1
Exit Function
End If
7.5 Output of Impedance Measurement Data