Creating Downloadable Programs

Branching, Looping, and Interrupting

170

OUTPUT 723;"^PROGRAM_1;TEXT@INSIDE PROGRAM_2@;";

Execute PROGRAM

1 and write \INSIDE PRO-

 

 

180

OUTPUT 723;"^;";

GRAM

 

2."

 

 

 

 

 

 

 

 

 

185

!

 

 

 

 

 

 

 

190

OUTPUT 723;"FUNCDEF PROGRAM_3,";

De￿ne PROGRAM

3.

 

 

200OUTPUT 723;"^PROGRAM_2;TEXT@INSIDE PROGRAM_3@;";

210OUTPUT 723;"^;";

220

OUTPUT 723;"PROGRAM_3;";

Execute PROGRAM

3. When all three user-

 

 

 

 

de￿ned functions have been executed, go to line

 

 

230.

 

 

225

!

 

 

 

230

OUTPUT 723;"PU;PA 300,200;";

 

 

 

240

OUTPUT 723;"TEXT@OUTSIDE USER-DEFINED FUNCTIONS@;"

 

 

 

What if in the program above, line 110 were modi￿ed to include the ABORT command in the PROGRAM 1 function?

110 OUTPUT 723;"IF YY,EQ,300;THEN; ABORT ;ENDIF;";

When ABORT is encountered, the PROGRAM 1 function is interrupted, the PROGRAM 2 and PROGRAM 3 functions are ignored, and the OSA commands following PROGRAM 3 are executed. Program operation resumes at line 230.

To use a conditional branch

￿Use the IF/THEN/ELSE command

This example shows multiple conditional branching. If MKA is greater than 010 dBm or less than 030 dBm, the value of MKA is displayed. Otherwise, the message \SIGNAL WITHIN TOLERANCE" is displayed.

50OUTPUT 723;"IP;CENTERWL 900NM;SP 400NM;ANNOT OFF;SNGLS;TS;MKPK

HI;"

60OUTPUT 723;"IF MKA,GT,-10DBM;THEN;DSPLY MKA,6,2;"

70OUTPUT 723;"ELSIF MKA,LT,-30DBM;THEN;DSPLY MKA,6,2;"

80OUTPUT 723;"ELSE TEXT$SIGNAL WITHIN TOLERANCE$;"

90OUTPUT 723;"ENDIF;"

6-10