HP 20b Consultant Financial, 30b Professional Long Programs and Battery Life, Sub-Function Call

Models: 20b Consultant Financial

1 114
Download 114 pages 5.83 Kb
Page 90
Image 90

Note:

Label numbers must be unique. Only one label with a given number can exist in the calculator.

You can jump from one program to another if you know that there is a specific label number in another program.

Use the tests ? Long Programs and Battery Life, ? Sub-Function Call , ? Manual background , ? Manual background , ? Manual background and ? Manual background (the top row of keys) to verify if two numbers are equal, different, and strictly, or not strictly, greater or smaller. These are dual operator-operands and are used in the same way as addition or

multiplication ( in Algebraic and Chain modes, number1 ?= number2 =, and in RPN mode, number1 Inumber2 ?= ) are used, in that they return 0 if false, and 1 if true. Note that in RPN mode, the tests do not remove the arguments from the stack, but do push a 0 or 1.

Long Programs and Battery Life

Although it is possible to create programs on the HP 30b that can run for a long period of time (calculating PI to 700 decimal places, for example) this is not something that we advise, as it will drain the batteries in less than a day.

Programming on the HP 30b was designed to create small programs to perform a function not present in the calculator, or to automate a task requiring many keystrokes and then run relatively quickly. If a program takes more than one second to run, the CPU speed will be reduced in order to preserve battery life.

Sub-Function Call

It is often useful in a program to have the option to reuse a sub-program from various locations. To avoid having to retype these sub-programs each time they are necessary, you can use the

Manual background (HOLD) Manual background and Manual background (HOLD) Manual background functions.

CALL, followed by a label number, will jump to the specified label, in the same way a GOTO instruction does, but, when the RETURN instruction is encountered, the program will continue execution just after the CALL function. This is equivalent to you temporarily pausing in an activity to answer a phone call, and then returning to your prior activity after the call. Up to four calls can be nested at the same time. Another way to picture this might be going to turn off your stove, while you are answering the doorbell that rang while you were answering your phone, while you were writing an email… it's hard for us, but computers are good at stacking tasks in this way.

Enter a call function the same way you enter a GOTO function.

82 Programming

Page 90
Image 90
HP 20b Consultant Financial, 30b Professional manual Long Programs and Battery Life, Sub-Function Call