User manual

2100-900-01 Rev. E / March 2012 Return to Section Topics A-33
Model 2100 6 1/2-Digit Resolution Digital Multimeter User’s Manual Appendix A: Remote Interface Reference
The following example uses CONFigure with the dBm math operation. The CONFigure
command gives you a little more programming flexibility than the MEASure? command. This
allows you to incrementally change the multimeter's configuration. The following example is shown
in Visual Basic.
Visual Basic programming example 2: CONFigure
The CONFigure function.
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub main()
Rem #########################################
Rem
Rem Using NI-VISA library visa32.dll
Rem
Rem Set sample count 5 configuration and
Rem read the trigger
Rem
Rem #########################################
Dim stat As ViStatus
Dim dfltRM As ViSession
Dim sesn As ViSession
Dim fList As ViFindList
Dim desc As String * VI_FIND_BUFLEN
Dim nList As Long
Dim ret As Long
Dim readin As String * 128
Dim i As Integer ' Array index
stat = viOpenDefaultRM(dfltRM)
If (stat < VI_SUCCESS) Then
'Rem Error initializing VISA ... exiting
MsgBox "USBTMC resource not found.", vbExclamation, "2100 multimeter device
test"
Exit Sub
End If
Rem Find all 2100 USBTMC instruments in the system
stat = viFindRsrc(dfltRM, "USB[0-9]*::0x05E6::0x2100::?*INSTR", fList, nList,
desc)
If (stat < VI_SUCCESS) Then
'Rem Error finding resources ... exiting
MsgBox "2100 device not found.", vbExclamation, "2100 multimeter device test"
viClose (dfltRM)
Exit Sub
End If
Rem Open a session to each and determine if it matches
stat = viOpen(dfltRM, desc, VI_NULL, VI_NULL, sesn)
If (stat < VI_SUCCESS) Then
MsgBox "Open device failed.", vbExclamation, "2100 multimeter device test"
stat = viClose(fList)
Exit Sub
End If