HP (Hewlett-Packard) F2215AA#ABA Calculator User Manual


 
13-14 Simple Programming
2. In the beginning of the program, insert an INPUT instruction for each variable
whose value you will need. Later in the program, when you write the part of the
calculation that needs a given value, insert a
variable instruction to bring
that value back into the stack.
Since the INPUT instruction also leaves the value you just entered in the
Xñregister, you don't have to recall the variable at a later time ó you could
INPUT it and use it when you need it. You might be able to save some memory
space this way. However, in a long program it is simpler to just input all your
data up front, and then recall individual variables as you need them.
Remember also that the user of the program can do calculations while the
program is stopped, waiting for input. This can alter the contents of the stack,
which might affect the next calculation to be done by the program. Thus the
program should not assume that the X–, Y–, and Zñregisters' contents will be
the same before and after the INPUT instruction. If you collect all the data in the
beginning and then recall them when needed for calculation, then this prevents
the stack's contents from being altered just before a calculation.
To respond to a prompt:
When you run the program, it will stop at each INPUT and prompt you for that
variable, such as . The value displayed (and the contents of the X–
register) will be the current contents of R.
To leave the number unchanged, just press
.
To change the number, type the new number and press
. This new
number writes over the old value in the X–register. You can enter a number as
a fraction if you want. If you need to calculate a number, use normal
keyboard calculations, then press
. For example, you can press
 in RPN mode, or press  
in ALG mode (Before you press , the expression will be displayed in
line 2. After you press , the result of expression will replace the
expression to display in line 2 and be saved in X-register).