
3-8
IM AQ6370C-17EN
3.3 Sample Program
Sample Program 1
Sending an invalid talker command to the AQ6370C/AQ6370D/AQ6373/AQ6373B/
AQ6375/AQ6375B and then receiving data with the instrument specified as a talker
causes the GP-IB bus to stop because the instrument has no data to send. In this case,
a GPIB timeout occurs, followed by recovery of the GP-IB bus.
The following shows an example of controlling the AQ6370C/AQ6370D/AQ6373/
AQ6373B/AQ6375/AQ6375B remotely using the Ethernet port. The sample program
uses Visual Basic 6.0 as the programming language. The program sets the measurement
conditions (center wavelength, span, sensitivity, and the sampling number) and then
performs a sweep. After completing this sweep, the program executes a thresh-based
spectrum width analysis and then outputs the results to the screen. The conditions are
the same as those of the GP-IB sample program in section 2.6, “Sample Program.”
Private Sub AQ637XTEST()
Dim intData As Integer
Dim dblMeanWL As Double
Dim dblSpecWd As Double
Dim strData As String
' === Connect ===
Winsock1.RemoteHost = "192.168.1.100"
' OSA IP address
Winsock1.RemotePort = 10001
' OSA remote port num
Winsock1.Connect
' === Wait to connect complete ===
While (Winsock1.State <> sckConnected)
DoEvents
Wend
' === Authentication by OPEN Command ===
SendLan "open ""anonymous"""
ReceiveLan strData
SendLan " "
ReceiveLan strData
If (Left(strData, 5) <> "ready") Then
MsgBox "User authentication error."
Exit Sub
End If
' === Set the measurement parameter ===
SendLan "*RST"
' Setting initialize
SendLan "CFORM1"
' Command mode set
(AQ637X mode)
SendLan ":sens:wav:cent 1550nm"
' sweep center wl
SendLan ":sens:wav:span 10nm"
' sweep span
SendLan ":sens:sens mid"
' sens mode = MID
SendLan ":sens:sweep:points:auto on"
' Sampling Point = AUTO
' === Sweep execute ===
SendLan ":init:smode 1"
' single sweep mode
SendLan "*CLS"
' status clear
SendLan ":init"
' sweep start