Chapter 7 7-19
Programming Examples
Measurement Setup Examples
Call checkErr(vi, err_status)
err_status = hp875x_autoscale(vi)
Call checkErr(vi, err_status)
‘ Channel 3 Reflected Power measurement, no parameter conversion
err_status = hp875x_channelSelect(vi, hp875x_CH3)
Call checkErr(vi, err_status)
err_status = hp875x_measType(vi, hp875x_IN_MA, hp875x_CONV_OFF)
Call checkErr(vi, err_status)
‘ Log magnitude and autoscale
err_status = hp875x_displaySelect(vi, hp875x_CH3, hp875x_DISP_DATA, hp875x_DISP_LOGM)
Call checkErr(vi, err_status)
err_status = hp875x_autoscale(vi)
Call checkErr(vi, err_status)
‘ Channel 4 Transmitted Power measurement, no parameter conversion
err_status = hp875x_channelSelect(vi, hp875x_CH4)
Call checkErr(vi, err_status)
err_status = hp875x_measType(vi, hp875x_IN_MB, hp875x_CONV_OFF)
Call checkErr(vi, err_status)
‘ Log magnitude and autoscale
err_status = hp875x_displaySelect(vi, hp875x_CH4, hp875x_DISP_DATA, hp875x_DISP_LOGM)
Call checkErr(vi, err_status)
err_status = hp875x_autoscale(vi)
Call checkErr(vi, err_status)
‘ Display all 4 measurements, each in a separate graticule, Channel 3 in upper right
err_status = hp875x_dualSplit4Parm(vi, hp875x_DUAL_CHAN_ON, hp875x_DISP_4_GRAT,
hp875x_DISP_2_CHAN3_TOP, hp875x_DISP_4_CHAN3_UPR)
Call checkErr(vi, err_status)
‘ Wait for analyzer to finish
err_status = hp875x_opc_Q(vi, “WAIT”, reply)
Call checkErr(vi, err_status)
‘ Close the session
err_status = hp875x_close(vi)
Call checkErr(vi, err_status)
‘ Display “Example Completed” message box
iRetVal = MsgBox(“The example has completed”, vbOKOnly, frmExample1a.Caption)
End Sub
Private Sub cmdQuit_Click()
‘ Close the application
End
End Sub
Public Sub initialize(ByVal nwa As String, ByVal id_query As Integer, ByVal do_reset
As Integer, vi As Long)
Dim err_status As Long
Dim err_msg As String * 256
‘ Note that this function will verify that the instrument
‘ specified is an hp875x (id_query=VI_TRUE) and will send
‘ a reset to the instrument (do_reset=VI_TRUE).
err_status = hp875x_init(nwa, id_query, do_reset, vi)
If ((err_status < VI_SUCCESS) Or (vi = VI_NULL)) Then
msg = “init failed with return code “ & err_status