Debugging Programs

The OSA's debug feature help to locate faulty program code. When the mode is on, each command sent to the OSA is tested and then displayed on the OSA's data line (located below the graticule). When a faulty command is encountered, subsequent commands are not executed. The faulty command is the last command shown to the right end of the displayed data line. Use the DEBUG command to turn debugging on and o￿.

The debug mode has fast and slow settings. Use fast debugging for trapping errors. Slow debugging executes the program slowly so you can monitor the execution of each command, much like stepping through a program on a computer. Both slow and fast debugging modes slow the execution of analyzer commands and should be turned o￿ when not needed, either with the front-panel controls or remotely via HP-IB.

The PAUSE command is another debugging function. When executed, PAUSE

suspends program operation and activates the debugging front-panel keys,

NSTEPNNNNNNNNNNNNN and NCONTNNNNN NNNNN. NSTEPNNNNNNNNNNNNN executes the analyzer program, one command at

a time. NCONTNNNNNNNNNN continues program operation. Once program operation is

halted, either by command or by error during debug mode, no further remote

input is possible until NCONTNN is pressed or NDEBUGNNNNNNNNNNNNNNNNNNOnNNNNNNNNNOffNNNNNNNNNN is set to o￿, or a

device-clear is sent (HP BASIC command CLEAR 723).

To debug a program

￿Place the DEBUG command before a section of code that needs testing.

30 OUTPUT 723;"DEBUG SLOW;"

Activate slow debug mode.

40OUTPUT 723;"SENS UP;ILLEGAL;" Operation stops at illegal command, called

ILLEGAL.

50 OUTPUT 723;"TS;"

60 OUTPUT 723;"MKPK HI;"

4-12