R3267 Series Spectrum Analyzer Operation Manual (Vol.1)
5.2.10 Example Programs
5-48
Example VB-8: Output the marker level
Dim sep As Integer
Call ibclr(spa)
’ Perform a device clear.
Call ibwrt(spa, "CF 30MZ")
’ Set the parameter.
Call ibwrt(spa, "SP 1MZ")
Call ibwrt(spa, "MK 30MZ")
’ The marker frequency is set to 30 MHz.
Call ibwrt(spa, "TS")
Call ibwrt(spa, "ML?")
’ Read the marker level.
Rdbuff = Space(30)
’ Allocate a total of 30 bytes to the buffer area.
Call ibrd(spa, Rdbuff)
’ Read the data (30 bytes Max.).
sep = InStr(1, Rdbuff, vbCrLf, 0)
’ Check the number of character to the delimiter.
RichTextBox1.Text = "MarkerLevel = " & Left(Rdbuff, sep - 1)
’ Outputs the data on the screen.
An example display:
MarkerLevel = -16.22
Example VB-9: Reading the center frequency and displaying it
Dim sep As Integer
Call ibclr(spa)
’ Performs a Device Clear.
Call ibwrt(spa, "CF?")
’ Query command for the center frequency.
Rdbuff = Space(30)
’ Allocate the buffer memory space to 30 bytes.
Call ibrd(spa, Rdbuff)
’ Read the data (30 bytes Max.)
sep = InStr(1, Rdbuff, vbCrLf, 0)
’ Check the number of characters prior to the delimiter.
RichTextBox1.Text = "CenterFreq = " & Left(Rdbuff, sep - 1)
’ Display the data on the screen.
An example display:
CenterFreq = 30.000E+6