7352 Series Digital Multimeter Operation Manual
6.7.4 Sample Programs (USB)
6-63
If ret <> OK Then
'If the device is closed incorrectly,
MsgBox "device CLOSE error", vbExclamation
End If
ret = ausb_end()
'USB terminates.
If ret <> OK Then
'If the USB terminates incorrectly,
MsgBox "USB end error", vbExclamation
End If
End Sub
------------------------------------------------------------------------
Private Sub ausbwrt(id As Long, command As String)
'Subroutine for transmitting the command
Dim ret As Long
'Declares the variable of the driver return value.
ret = ausb_write(id, command)
'Transmits the command.
If ret <> OK Then
MsgBox "transmission error", vbExclamation
GoTo err_exit
End If
Exit Sub
err_exit:
ret = ausb_close(DMM)
If ret <> OK Then
MsgBox "device CLOSE error", vbExclamation
End If
ret = ausb_end()
If ret <> OK Then
MsgBox "USB end error", vbExclamation
End If
End Sub
------------------------------------------------------------------------
Private Sub ausbrd(id As Long, dt As String)
'Subroutine for receiving data
Dim ret As Long
'Declares the variable of the driver return value.
Dim siz As Long
ret = ausb_read(id, dt, 50, siz)
'Receives data.
If ret = OK Then
dt = Left$(dt, siz - 1)
Else
MsgBox "receiving error", vbExclamation
GoTo err_exit
End If
Exit Sub
err_exit:
ret = ausb_close(DMM)
If ret <> OK Then
MsgBox "device CLOSE error", vbExclamation
End If
ret = ausb_end()
If ret <> OK Then
MsgBox "USB end error", vbExclamation
End If
End Sub