4-32
Programming
Example Programs
Example 2. Measure WDM channels
This program measures the multiple laser lines of a WDM system. It measures
both the power and wavelengths of each line. First, the program sets the
Agilent 86120B in the single-acquisition measurement mode. Then, it triggers
the Agilent 86120B with the MEASure command to capture measurement
data of the input spectrum. Because the data is stored in the instrument’s
memory, it can be queried as needed.
Refer to the introduction to this section for a description of each subroutine
that is contained in this program.
COM /Instrument/ @Mwm
ASSIGN @Mwm TO 720
ON ERROR GOTO Error_msg,
Set_ese
PRINT USING "37A,33A";"Multi-Wavelength Meter Identity is : ";FNIdentity$
OUTPUT @Mwm;":INIT:CONT OFF"
ON TIMEOUT 7,5 CALL Err_mngmt
OUTPUT @Mwm;":MEAS:ARR:POW:WAV?"
ENTER @Mwm USING "#,K";Nb_wl
ALLOCATE Current_wl(1:Nb_wl)
ENTER @Mwm USING "#,K";Current_wl(*)
OUTPUT @Mwm;":FETC:ARR:POW?"
ENTER @Mwm USING "#,K";Nb_wl
ALLOCATE Current_pwr(1:Nb_wl)
ENTER @Mwm USING "#,K";Current_pwr(*)
FOR I=1 TO Nb_wl
PRINT USING "22A,2D,6A,4D.2DE,4A,S2D.2D,3A";"The wavelength number ";Current_wl(I);" at
";Current_pwr(I);"dBm"
NEXT I
OFF TIMEOUT
STOP
Error_msg:
PRINT "the prgm is aborted due to : ";ERRM$
END