
14-57
IM 760401-01E
Communication Commands 2 (System of Commands Complying to the IEEE 488.2-1992 Standard)
14
14.9 Sample Program (Output of Harmonic
Measurement Data)
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 cnt As Integer
Dim item As Integer
Dim comma As Integer
Dim length As Integer
term = Chr$(10) 'terminator
msg = Space$(100)
qry = Space$(1000)
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
GoTo GPIBError
End If
'Set the measurement condition
msg = "SAMPLE:RATE 500MS" + term 'Update rate = 500ms
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
GoTo GPIBError
End If
'Set the measurement range
msg = "VOLTAGE:RANGE 150V" + term 'Voltage range = 150V
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
GoTo GPIBError
End If
msg = "CURRENT:RANGE 5A" + term 'Current range = 5A
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
GoTo GPIBError
End If
'Setting related to harmonics analize
'Object element = 1, PLL source = V1, Computation method of THD = IEC
msg = "HARMONICS:ELEMENT 1;SYNCHRONIZE V,1;THD IEC;STATE ON" + term
sts = ilwrt(Dev, msg, Len(msg)) 'Send Command
If (sts < 0) Then
GoTo GPIBError
End If
'Set the communication output items
'1. All function -> off
msg = "MEASURE:HARMONICS:ITEM:PRESET CLEAR" + term
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
GoTo GPIBError
End If
'2. Necessary function -> on
msg = "MEASURE:HARMONICS:ITEM:SYNCHRONIZE ON;ATHD ON;A ON" + term
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
GoTo GPIBError
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))
If (sts < 0) Then
GoTo GPIBError
End If
Summary of Contents for WT210
Page 1: ...Digital Power Meter IM 760401 01E 3rd Edition ...
Page 208: ...13 18 IM 760401 01E 13 3 Sample Program Image ...
Page 214: ...13 24 IM 760401 01E 13 5 Sample Program Output of Normal Measurement Data ...
Page 266: ...14 50 IM 760401 01E 14 6 Sample Program Image ...
Page 272: ...14 56 IM 760401 01E 14 8 Sample Program Output of Normal Measurement Data ...