' === Capture analytical results ===
dblMeanWL = Val(Left(strData, 16)) ' get mean wavelegnth
dblSpecWd = Val(Mid(strData, 18, 16)) ' get spectrum width
' === Output the result to the screen ===
MsgBox ("MEAN WL: " & dblMeanWL * 1000000000# & " nm" & vbCrLf & _
"SPEC WD: " & dblSpecWd * 1000000000# & " nm")
' === Disconnect ===
Call EnableLocal(BOARD_ID, intAddrList())
End Sub
'==================================================
' Sub routine
' Send Remote Command
'==================================================
Sub SendGPIB(intAddr As Integer, strData As String)
Call Send(BOARD_ID, intAddr, strData, NLend)
If (ibsta And EERR) Then
MsgBox " GP-IB device can't write"
End If
End Sub
'==================================================
' Sub routine
' Recieve query data
'==================================================
Function RecieveGPIB(intAddr As Integer) As String
Const READSIZE = 10000
Dim strBuffer As String
strBuffer = Space(READSIZE)
RecieveGPIB = ""
Do
DoEvents
Call Receive(BOARD_ID, intAddr, strBuffer, STOPend)
If (ibsta And EERR) Then
MsgBox " GP-IB device can't read."
RecieveGPIB = ""
Exit Function
Else
RecieveGPIB = RecieveGPIB & Left(strBuffer, ibcntl)
End If
Loop Until ((ibsta And EEND) = EEND)
End Function
2.6 Sample Program