2100-900-01 Rev. D / September 2011 Return to Section Topics B-31
Model 2100 6 1/2-Digit Resolution Digital Multimeter User’s Manual Appendix B: Remote Interface Reference
Creating the application
To create a new Visual Basic 6 project:
1. Create a new Standard.EXE project.
2. From the main menu, select Project, then select Project 1 Properties and press the OK
button.
3. Set the startup object for a Windows application to Sub Main and press the OK button.
4. From the main menu, select Project, then select Add Module and press the Open button.
5. Cut and paste the code below into module 1.
6. From the main menu, select Project, then select References.
7. Select Browse... and navigate to the C:\Windows\System32 directory.
8. Select the file, visa32.dll, and click the Open button (this will add a reference to the “VISA
Library”).
9. Save your project.
The Sub Main function is where you need to add initialization code.
Sub Main()
Rem #########################################
Rem
Rem Using NI-VISA library visa32.dll
Rem
Rem Set device on the VOLTage:DC configure and
Rem read the measure
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 * 64
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