beautypg.com

BNC 1201 - 6 1/2 Digit Digital Multimeter User Manual

Page 166

background image

167

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, "1201 multimeter device
test"
stat = viClose(fList)
Exit Sub
End If
Rem send reset command '*RST' -- reset 1201
stat = viWrite(sesn, "*RST", 4, ret)
If (stat < VI_SUCCESS) Then
MsgBox "System command error. (*RST)", vbExclamation, "1201
multimeter device test"
stat = viClose(fList)
Exit Sub
End If
Rem send Clear command '*CLS'-- Clear 1201 status register
stat = viWrite(sesn, "*CLS", 4, ret)
If (stat < VI_SUCCESS) Then
MsgBox "System command error. (*CLS)", vbExclamation, "1201
multimeter device test"
stat = viClose(fList)
Exit Sub
End If

Rem send measure command -- Set to 0.1 volt dc range
stat = viWrite(sesn, "meas:volt:DC? 0.1,0.01", 22, ret)
If (stat < VI_SUCCESS) Then
MsgBox "System command error. (meas:volt:dc? ...)", vbExclamation,
"1201 multimeter device test"
stat = viClose(fList)
Exit Sub
End If

Rem fetch the measure data
stat = viRead(sesn, readin, 64, ret)
If (stat < VI_SUCCESS) Then
MsgBox "Read in data error.", vbExclamation, "1201 multimeter device test"
stat = viClose(fList)
Exit Sub
End If

Debug.Print "Rdg = "; readin

Rem set to local mode
stat = viWrite(sesn, "system:local", 12, ret)
If (stat < VI_SUCCESS) Then
MsgBox "System command error. (system:local)", vbExclamation, "1201
multimeter device test"
stat = viClose(fList)
Exit Sub
End If

stat = viClose(sesn)
stat = viClose(fList)
stat = viClose(dfltRM)

MsgBox "End of Job."

End Sub