E5071C
1198
Dim SelMode As String
Dim Result As String * 10000
Dim RealData As Double
Dim ImagData As Double
Dim FreqData As Double
ReDim Error_Term_Data(Nop * 2) As String 'Defines the stock variables for the error coefficient
as needed for NOP.
ReDim Freq_Data(Nop) As String 'Defines the stock variables for the frequency values.
SelMode = Cells(3, 6) 'Reads the read/write mode.
Select Case SelMode
Case "Read" 'Reads the error coefficient from the ena.
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COEF? " & ErrTerm & "," & Respons & "," & Stimulus &
vbLf, 0) 'Read the calibration coefficient data.
Call viVScanf(vi, "%t", Result)
Error_Term_Data = Split(Result, ",") 'Splits the read data by comma.
Freq_Data = Make_Freq(vi, Nop) 'Calculates the frequency values.
For i = 0 To Nop - 1
RealData = CDbl(Error_Term_Data(i * 2)) 'Reads the real data from error coefficient items.
ImagData = CDbl(Error_Term_Data(i * 2 + 1)) 'Reads the imag data from error coefficient
items.
FreqData = CDbl(Freq_Data(i + 1)) 'Reads the frequency values.
Cells(10 + i, 2) = RealData 'Displays the real data to the excel sheet.
Cells(10 + i, 3) = ImagData 'Displays the imag data to the excel sheet.
Cells(10 + i, 1) = FreqData 'Displays the frequency values to the excel sheet.
Next i
Call Data_Plot(vi, Nop, ErrTerm) 'Displays the graph to the excel sheet.
Case "Write" 'Write the error coefficient to the ena.
Error_Term_Data = ErrTerm & "," & Respons & "," & Stimulus 'Sets the command parameter.
For i = 0 To Nop - 1
RealData = Cells(10 + i, 2) 'Retrieves the real data from the excel sheet.
ImagData = Cells(10 + i, 3) 'Retrieves the imag data from the excel sheet.