R3132 Series Spectrum Analyzer Operation Manual
4.2.10 Example Programs
4-55
Example VB-13: Reading and displaying the three largest peak levels
Dim pk1 As String, pk2 As String, pk3 As String
Call ibclr(spa) ’ Perform a device clear.
Call ibwrt(spa, "CF 0MZ") ’ Apply the settings.
Call ibwrt(spa, "SP 100MZ")
Call ibwrt(spa, "PS") ’ Search for the peak.
Call ibwrt(spa, "ML?") ’ Query command to search for the marker level
Rdbuff = Space(25) ’ Reserve buffer memory space.
Call ibrd(spa, Rdbuff) ’ Receives the output.
pk1 = LeftB(Rdbuff, (InStrB(1, Rdbuff, Chr(13), 1) - 1))
’ Read the data between the starting point and the delimiter.
Call ibwrt(spa, "NXP") ’ Search for the next peak.
Call ibwrt(spa, "ML?")
Rdbuff = Space(25)
Call ibrd(spa, Rdbuff)
pk2 = LeftB(Rdbuff, (InStrB(1, Rdbuff, Chr(13), 1) - 1))
’ Read the data between the starting point and the delimiter.
Call ibwrt(spa, "NXP")
Call ibwrt(spa, "ML?")
Rdbuff = Space(25)
Call ibrd(spa, Rdbuff)
pk3 = LeftB(Rdbuff, (InStrB(1, Rdbuff, Chr(13), 1) - 1))
’ Read the data between the starting point and the delimiter.
RichTextBox1.Text = "1st PK = " & pk1 & vbCrLf & "2nd PK = " & pk2 & vbCrLf & "3rd PK = " & pk3 & vbCrLf
’ Display the data on the screen.
An example display:
1st PK = -8.553906250000E+01
2nd PK = -7.004687500000E+01
3rd PK = -8.655468750000E+01