R3267 Series Spectrum Analyzer Operation Manual (Vol.1)
5.2.10 Example Programs
5-51
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 = 9.44
2nd PK = 10.06
3rd PK = 11.84