Sample Program
7-11
IM 760101-11E
7
Sample2(GPIB) Get Harmonics Data
----------------------------------------------------------------------------------------
Private Function GpibHarmonics() 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
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
GpibHarmonics = 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)
GpibHarmonics = 1
Exit Function
End If
'Set the measurment condition
msg = "VOLTAGE:RANGE:ELEMENT1 100V" + term 'Voltage range = 100V
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
msg = "HARMONICS:OBJECT SIGMA" + term 'Harmonics Object = SigmaA
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
msg = "HARMONICS:PLLSOURCE U1" + term 'PLL Source = U1
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
msg = "HARMONICS:ORDER 0,100" + term 'Order = 0 - 100
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
msg = "HARMONICS:STATE ON" + term 'Harmonics mode
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
'Set the transition filter used to detect the completion of the data updating
msg = "STATUS:FILTER1 FALL" + term 'Falling edge of bit0(UPD)
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
'Wait until harmonics measure is stable (4 samples in this program)
For wait = 1 To 4
'Clear the extended event register (Read and trash the response)
msg = "STATUS:EESR?" + term
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibHarmonics = 1
Exit Function
End If
sts = ilrd(Dev, qry, Len(qry)) 'Receive Query
7.5 Output of Harmonic Measurement Data
Summary of Contents for wt1600
Page 1: ...Digital Power Meter Communication Interface IM 760101 11E 4th Edition ...
Page 131: ...7 2 IM 760101 11E 7 2 Sample Program Image ...
Page 138: ...Sample Program 7 9 IM 760101 11E 7 7 4 Output of Normal Measurement Data ...
Page 142: ...Sample Program 7 13 IM 760101 11E 7 7 5 Output of Harmonic Measurement Data ...