4-34
Programming
Example Programs
Example 3. Measure WDM channel drift
This program measures the drift of channels in a WDM system. It measures
drift in both power and wavelength of each line. First, the program sets the
Agilent 86120B in the continuous-acquisition measurement mode. Then, it
measures drift using commands from the CALCulate3 subsystem.
Notice the use of the Tempo subroutine to pause the program for 10 seconds
while the Agilent 86120B measures the drift on the laser.
The use of the Err_mngmt subroutine is optional. Refer to the introduction to
this section for a description of each subroutine that is contained in this pro-
gram.
COM /Instrument/ @Mwm
ASSIGN @Mwm TO 720
DIM Key$[1]
ON ERROR GOTO Error_msg
Set_ese
PRINT USING "37A,33A";"Multi-Wavelength Meter Identity is: " ;FNIdentity$
ON TIMEOUT 7,5 CALL Err_mngmt
Cmd_opc("*RST")
Cmd_opc(":INIT:IMM")
Cmd_opc("*OPC")
Cmd_opc(":CONF:ARR:POW:WAV")
! Turn on the drift calculation
Cmd_opc(":CALC3:DRIF:STAT ON")
Err_mngmt(":CALC3:DRIF:STAT ON")
! Turn off all drift states
Cmd_opc(":CALC3:DRIF:PRES")
Err_mngmt(":CALC3:DRIF:PRES")
! Turn on drift reference state
Cmd_opc(":CALC3:DRIF:REF:STAT ON")
Err_mngmt(":CALC3:DRIF:REF:STAT ON")
! Query the number of data points
OUTPUT @Mwm;":CALC3:POIN?"
ENTER @Mwm USING "#,K";Nb_pt
ALLOCATE Current_ref_wl(1:Nb_pt)
ALLOCATE Current_ref_pwr(1:Nb_pt)