GPIB Operation Programming Examples
ML2437A/38A OM/PM PN: 10585-00001 Rev. P 8-133
Get Graph Data
Function GetGraphData ()
‘ function assumes that you have the graph display
‘ setup and that there is a global array called
‘ Graph_Data().
‘ make space for the result
Dim result As String
result = String$(2048, 0)
‘ set up a 2K buffer for the data to put in.
‘ Set the command up
Cmd = “OGD” : CmdLength = Len(Cmd)
‘ Send the command to the device at address 13
‘ (default address of the power meter)
Call DLLsend(0, 13, Cmd, CmdLength, NLend, ibsta%,
iberr%, ibcntl&)
‘ Receive the data from ML2430A at address 13
Call DLLreceive(0, 13, result, 2048, STOPend, ibsta%, iberr%,
ibcntl&)
result = Left(result, ibcntl&) - 1
‘ Get number of elements
Number_of_elements = Val(Mid(result, 5, InStr(5, result, “,”) - 5))
‘ redimension our global array
ReDim GraphData(1 To Number_of_elements) As Single
‘ format the result string so that we only have
‘ the elements.
result = Right(result, Len(result) - InStr(5, result, “,”))
‘ loop through elements and place into our global array
For I = 1 To Number_of_elements
next_place = InStr(result, “,”) - 1
If next_place = -1 Then next_place = Len(result)
GraphData(I) = Val(Mid(result, 1, next_place))
‘ reduce the elements by one
‘ (the one we have just put in the array)
result = Right(result, Len(result) - InStr
(result, “,”))
Next I
End Function