Conditional Statements In Subprograms; For; Nesting Subprograms - Agilent Technologies 3458A User Manual

Hide thumbs Also See for 3458A:
Table of Contents

Advertisement

Nesting Subprograms

Conditional Statements in Subprograms

FOR...NEXT Loops
278
Chapter 7 BASIC Language for the 3458A
in the subprogram. The RETURN command returns control to the caller
without executing the SUBEND command. For example,
10 OUTPUT 722; "SUB DMM_CONF"
20 OUTPUT 722; "DCV 8, 0.00125"
30 OUTPUT 722; "TRIG SGL"
40 OUTPUT 722; "ENTER A'
60 OUTPUT 722; "IF A<5.06 THEN; RETURN"
70 OUTPUT 722; "ELSE"
80 OUTPUT 722; "TRIG SGL"
90 OUTPUT 722; "ENDIF"
100 OUTPUT 722; "SUBEND"
110 !
120 OUTPUT 722; "CALL DMM_CONF"
130 END
One subprogram may call a second (nested) subprogram for execution before
the first subprogram finishes execution. When the second subprogram
executes the SUBEND command, the first subprogram continues with the
next command following the embedded CALL command.
The 3458A has two requirements for nesting subprograms. First, the
subprogram called from within another subprogram must be stored in internal
memory before the subprogram doing the calling is stored. This is because
the 3458A checks the syntax of each command as it stores the subprogram.
When it encounters an embedded CALL command, the 3458A checks to see
if a subprogram by that name exists in memory. If not, it generates an error.
Second, subprograms may not be nested more than 10 levels deep. You
cannot place one subprogram inside of another subprogram. For example,
the following program will generate an error.
10 OUTPUT 722; "SUB DMM_CONF"
20 OUTPUT 722;"DCV8,0.00125"
30 OUTPUT 722; "SUB TESTER"
40 OUTPUT 722; "SUBEND"
50 !
60 OUTPUT 722; "CALL DMM_CONF"
70 END
The 3458A provides three BASIC language statements for conditional
branching and looping. Use these statements only within 3458A
subprograms. Conditional branching and looping statements provide for
repetitive tests, initializing arrays, etc.
The three conditional statements are: FOR...NEXT, WHILE...ENDWHILE,
and IF...THEN. These statements are similar to those used in an enhanced
BASIC language. The only exception is that 3458A subprograms do not have
line numbers or GOTO statements for branching. Looping and conditional
branching statements may be nested seven deep.
The FOR...NEXT command defines a loop which is repeated until a loop
counter passes a specified value. The syntax statement for the FOR...NEXT
!This results in an error

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents