Get Graph Data
Func tion GetGraphData ()
‘ func tion as sumes that you have the graph dis play
‘ setup and that there is a global ar ray called
‘ Graph_Data().
‘ make space for the re sult
Dim re sult As String
re sult = String$(2048, 0)
‘ set up a 2K buffer for the data to put in.
‘ Set the com mand up
Cmd = “OGD” : CmdLength = Len(Cmd)
‘ Send the com mand to the de vice at ad dress 13
’ (de fault ad dress of the power me ter)
Call DLLsend(0, 13, Cmd, CmdLength, NLend, ibsta%,
iberr%, ibcntl&)
‘ Re ceive the data from ML2400A at ad dress 13
Call DLLreceive(0, 13, re sult, 2048, STOPend, ibsta%, iberr%, ibcntl&)
re sult = Left(re sult, ibcntl&) - 1
‘ Get num ber of el e ments
Num ber_of_el e ments = Val(Mid(re sult, 5, InStr(5, re sult, “,”) - 5))
‘ redimension our global ar ray
ReDim GraphData(1 To Num ber_of_el e ments) As Sin gle
‘ for mat the re sult string so that we only have
’ the el e ments.
re sult = Right(re sult, Len(re sult) - InStr(5, re sult, “,”))
‘ loop through el e ments and place into our global ar ray
For I = 1 To Num ber_of_el e ments
next_place = InStr(re sult, “,”) - 1
If next_place = -1 Then next_place = Len(re sult)
Graph Data(I) = Val(Mid(re sult, 1, next_place))
‘ re duce the el e ments by one
‘ (the one we have just put in the ar ray )
re sult = Right(re sult, Len(re sult) - InStr
(re sult, “,”))
Next I
End Func tion
6-132 ML2400A OM
PROGRAMMING EXAMPLES GPIB OPERATION