Agilent Technologies 86082A User Manual page 245

Wavelength domain component analyzer
Table of Contents

Advertisement

Remote Operation
Example Programs
Dim NumLengthBytes As Integer: NumLengthBytes = 4
Dim numPoints As Integer: numPoints = 1001
Dim i As Long
Dim ValStr As String
Dim StartPos As Long: StartPos = 7
Dim Status As Long: Status = 0
On Error GoTo ErrorHandler
'-- Find out if we have Real32 or Real64. Real32 (4 bytes) is the suggested default
'-- format
If eDataSize = eREAL64 Then
NumBytes = 8
End If
'-- How many length bytes are there
NumLengthBytes = CInt(Mid(BinASCTrace, 2, 1))
'-- Determine the number of points
numPoints = CInt(Mid(BinASCTrace, 3, NumLengthBytes) / NumBytes)
'-- Calculate the start position of the first value (2 for header, NumLengthBytes,
'-- 1 more for first value)
StartPos = 3 + NumLengthBytes
'-- Resize result array according to the number of points
ReDim dResult(0 To numPoints - 1) As Double
For i = 0 To numPoints - 1
'-- Pull out the next value in the trace
ValStr = Mid(BinASCTrace, (i * NumBytes) + StartPos, NumBytes)
'-- Convert the binary value to a double and store it in the array
dResult(i) = prvtBinASCToDouble(ValStr, eDataSize, Status, ErrMsg)
If Status <> 0 Then Call Err.Raise(Status, "prvtBinASCToDouble", ErrMsg)
Next i
ErrMsg = ""
BinASCToArray = 0
Exit Function
ErrorHandler:
ErrMsg = Err.Description
BinASCToArray = Err.Number
End Function
Private Function prvtBinASCToDouble(ByVal BinASCVal As String, _
5-70
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
ByVal eDataSize As enumDataSize, _
Optional ErrNum As Long = 0, _
Optional ErrMsg As String = "") As Double

Advertisement

Table of Contents
loading

Table of Contents