HP 30b HP 20b Business Consultant and HP 30b Business Professional User's Guid - Page 90

Long Programs and Battery Life, Sub-Function Call, reduced in order to preserve battery life. - decimal places

Page 90 highlights

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 and ? (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 I number2 ?= ) 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 (HOLD) and (HOLD) 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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114

Programming
82
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
?
,
?
,
?
,
?
,
?
and
?
(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
I
number2 ?= ) 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
(HOLD)
and
(HOLD)
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.