Agilent Technologies 86082A User Manual page 247

Wavelength domain component analyzer
Table of Contents

Advertisement

Remote Operation
Example Programs
'-- The mantissa size starts after the exponent and ends with the least significant 1
MantValLen = LSOne - MantStart + 1
If Exp <> 0 Then
'-- Value is normalized. Caclulate the value of the mantissa:
'-- 1 + (MantVal/(2^MantValLen))
Mantissa = 1 + _
(prvtBinStrToDec(Mid(BinaryStr, MantStart, MantValLen), Status, ErrMsg) / _
(2 ^ MantValLen))
Else
'-- Value is denormalized. There will not be an assumed 1 for the Mantissa. Set Exp
'-- to 1 so math below is still valid. Formula: (MantVal/(2^MantValLen))
Mantissa = prvtBinStrToDec(Mid(BinaryStr, MantStart, MantValLen), Status, ErrMsg) _
/ (2 ^ MantValLen)
Exp = 1
End If
'-- Either mantissa calculation could return an error. Check status number.
If Status <> 0 Then Call Err.Raise(Status, "prvtBinStrToDec", ErrMsg)
Else
'-- Mantissa is 0. If exponent portion of binary string is 0, then the value is 0
If prvtBinStrToDec(Mid(BinaryStr, EXP_START, ExpSize), Status, ErrMsg) = 0 Then
Mantissa = 0
Exp = 0
SignBit = 0
End If
End If
prvtBinASCToDouble = SignBit * Mantissa * Exp
ErrMsg = ""
ErrNum = 0
Exit Function
ErrorHandler:
ErrMsg = Err.Description
ErrNum = Err.Source
prvtBinASCToDouble = 0
End Function
Private Function prvtBinASCToBinStr(BinASC As String, Optional ErrNum As Long = 0, _
'-- This function is designed to take an IEE-754 binary value and covert it to a pure
'-- binary string.
Dim TempHex As String: TempHex = ""
Dim TempBin As String: TempBin = ""
5-72
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Optional ErrMsg As String = "") As String

Advertisement

Table of Contents
loading

Table of Contents