46
DME1600
B
Sample Programs
This appendix contains three sample programs.
Program 1: Making a single measurement by using a MEA-
Sure? command
In the following example, a MEASure? command is used to measure the AC current once.
This is the simplest method for programming DME1600 measurements, but it is also the least
flexible. This sample program is written in Visual Basic.
An initialization code must be added to the Sub Main function.
Sub Main()
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, "DME1600
multimeter device test"
Exit Sub
End If
Rem Find all DME1600 USBTMC instruments in the system
stat = viFindRsrc(dfltRM, "USB[0-9]*::0x164E::0x0DAD::?*INSTR", fList,
nList, desc)
If (stat < VI_SUCCESS) Then
'Rem Error finding resources ... exiting
MsgBox "DME1600 device not found.", vbExclamation, "DME1600
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, "DME1600 multimeter
device test"
stat = viClose(fList)
Exit Sub
End If
Rem send reset command '*RST' -- reset DME1600
stat = viWrite(sesn, "*RST", 4, ret)
If (stat < VI_SUCCESS) Then
Содержание DME1600
Страница 4: ...4 DME1600 This page left blank intentionally...
Страница 5: ...Setup This chapter explains the settings that you need to configure to use the interfaces 1...
Страница 9: ...Message Reference This chapter explains the SCPI com mands 2 Message Reference...
Страница 43: ...Appendix A Error Messages B Sample Programs...
Страница 55: ......