Agilent Technologies 86082A User Manual page 249

Wavelength domain component analyzer
Table of Contents

Advertisement

Remote Operation
Example Programs
ErrMsg = ""
ErrNum = 0
Exit Function
ErrorHandler:
prvtBinASCToBinStr = ""
ErrMsg = Err.Description
ErrNum = Err.Number
End Function
Private Function prvtBinStrToDec(ByVal BinASC As String, Optional ErrNum As Long = 0, _
'-- This function will take a binary string and convert it to a double
Dim TempVal As Double: TempVal = 0
Dim NextOne As Integer
Dim MaxLen As Integer
On Error GoTo ErrorHandler
'-- Find every 1 and calculate its value
MaxLen = Len(BinASC)
NextOne = InStr(BinASC, "1")
'-- Make sure 0 wasn't passed in
If NextOne <> 0 Then
Do
'-- Add up all the 1s (2^n)
TempVal = TempVal + 2 ^ (MaxLen - NextOne)
'-- Find the next 1
NextOne = InStr(NextOne + 1, BinASC, "1")
Loop While NextOne <> 0 '0 is returned when there are no more matches
End If
prvtBinStrToDec = TempVal
ErrMsg = ""
ErrNum = 0
Exit Function
ErrorHandler:
ErrMsg = Err.Description
ErrNum = Err.Number
prvtBinStrToDec = 0
End Function
5-74
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Optional ErrMsg As String = "") As Double

Advertisement

Table of Contents
loading

Table of Contents