HP 50g Graphing Calculator User Manual

Page 670

Advertising
background image

Page 21-23

@SST

@

Result: empty stack, executing

a

@SST

@

Result: empty stack, entering subprogram

«

@SST

@

Result: ‘2*a^2+3’

@SST

@

Result: ‘2*a^2+3’, leaving subprogram »

@SST

@

Result: ‘2*a^2+3’, leaving main program»

Further pressing the

@SST

@ soft menu key produces no more output since we

have gone through the entire program, step by step. This run through the
debugger did not provide any information on why the program is not
calculating the value of 2a

2

+3

for a = 2. To see what is the value of a in the

sub-program, we need to run the debugger again and evaluate a within the
sub-program. Try the following:

J

Recovers variables menu

³

@FUNCa `

Copies program name to stack level 1

„°LL

@)@RUN@ @@DBG@

Starts debugger

@SST

@

Step-by-step debugging, result: “Enter a:”

@SST

@

Result: {“ a:” {2 0} V}

@SST

@

Result: user is prompted to enter value of a

2`

Enter a value of 2 for a. Result: “ :a:2”

@SST

@

Result: a:2

@SST

@

Result: empty stack, executing

a

@SST

@

Result: empty stack, entering subprogram

«

At this point we are within the subprogram

«

‘2*a^2+3’

» which uses the local

variable a. To see the value of a use:

~„aμ

This indeed shows that the local variable a = 2

Let’s kill the debugger at this point since we already know the result we will get.
To kill the debugger press

@KILL. You receive an

<!> Interrupted

message

acknowledging killing the debugger. Press $to recover normal calculator
display.

Note: In debugging mode, every time we press

@SST

@ the top left corner of the

display shows the program step being executed. A soft key function called

@@SST@ is also available under the @)RUN sub-menu within the PRG menu. This can
be used to execute at once any sub-program called from within a main
program. Examples of the application of

@@SST@ will be shown later.

Advertising