0% found this document useful (0 votes)
8 views

HP30b 36Programming automating tasks

The HP 30b calculator allows users to automate repetitive calculations through programming, enabling the creation of up to 10 programs with a maximum of 290 bytes of memory. Users can assign functions from menus to keys for quicker access, and the document provides examples for automating the normal distribution probability function and the inverse sine function. Additionally, it explains how to label programs for easier identification in the program catalog.

Uploaded by

Fábio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

HP30b 36Programming automating tasks

The HP 30b calculator allows users to automate repetitive calculations through programming, enabling the creation of up to 10 programs with a maximum of 290 bytes of memory. Users can assign functions from menus to keys for quicker access, and the document provides examples for automating the normal distribution probability function and the inverse sine function. Additionally, it explains how to label programs for easier identification in the program catalog.

Uploaded by

Fábio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

hp calculators

HP 30b Programming – Automating Tasks

Programming on the HP 30b

Automating functions from menus

Example 1: Assigning the normal distribution


probability function

Example 2: Assigning the inverse sine function

Example 3: Giving a title to a program in the


program catalog
hp calculators

HP 30b Programming - Automating Tasks

Programming on the HP 30b

The HP 30b Business Professional calculator includes a programming capability designed to help automate repetitive
calculations and extend the usefulness of the built-in function set of the calculator. The capability includes the creation of
up to 10 separate programs using up to 290 bytes of memory among them.

Programs record keystrokes, with each keystroke using one byte of memory, although some commands use more than
one byte. In addition, many program-only functions are provided for conditional tests, “gotos”, looping, displaying
intermediate results and even calling other programs as subroutines.

This learning module will show how to automate repetitive calculations to save time as well as how to bring functions out
of menus and onto the keyboard. Other learning modules will show how to enter and edit programs, loop and call
subroutines as well as showing several example programs to help get you started.

As shown in the picture at right, the HP 30b has additional


functions assigned to the keys that are program-only
functions. Other than the Black-Scholes function (shown as
Black S), which is not a program function but a financial
function, these functions are not printed or labeled on the
actual HP 30b itself. However, an overlay is provided that
lays over the top rows of keys that help indicate how these
functions are mapped to the keys.

Each of these functions is inserted into a program by


pressing the shift key and holding it down while pressing the
key under which the program function is displayed. For
example, to insert a LBL (label) command, press : and,
while holding it down, press %. In these learning modules
describing programming, this will be shown as : + %.
Pressing that key combination will insert a LBL instruction
into a program in program edit mode. Pressing that key
combination in calculation mode will do nothing.

There are 10 numbered slots available for programs,


numbered from 0 to 9. These are displayed in the program
catalog which is viewed by pressing : . In the image
above, the program catalog is displayed, showing Prgm 0 or program 0. Pressing the > or < keys will scroll
through the list of 10 programs. Pressing I will enter the selected program, allowing you to view the program steps
stored in that program slot or to change the program steps. To exit this program editing mode and return to the program
catalog, press : . To exit the program catalog and return to calculation mode, press O.

When a program is displayed, a number will be shown below it indicating how many bytes are used. If the program name
is shown in reverse video, then the program has been assigned to a key and can be executed by pressing the
appropriate key combination, even when in calculation mode, as shown
in the image at right. When viewing a program in the program catalog,
pressing :xI will delete the presently displayed program
and return to the calculation environment. To delete all programs, press
:x>>II while in calculation mode.

hp calculators -2- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

At different places within a program, you can insert a Label (LBL) command. A label defines a location to which program
control may be transferred. The HP 30b can handle up to 100 labels within the entire program memory. These labels are
a two-digit numeric value from 00 to 99. No label can be used more than once, which makes each label a “global” label
and defined only once within the global program memory space. If you attempt to enter a label that has already been
used, a message saying “Exists!” will be briefly displayed.

Automating functions from menus


The HP 30b is a powerful calculator containing many useful functions. Some of these functions are found several layers
deep in menus. If you need to use a function deep in a menu several times in a row, this can become somewhat tedious.
With a small investment in time, it is possible to easily bring a function out of a menu where it can be accessed at the
press of a key. This is done by writing a short program that executes the function where the key presses necessary to
access the function are entered by the program itself.

Example 1: Suppose you needed to compute the area under the normal distribution curve for a number of standardized
z-score values. The normal distribution probability function is labeled LTND located in the math menu as shown below.

To automate this type of function found in a menu, make a list of the exact keys pressed to access the function manually.
These key presses will be entered in the program. In this case, once the standardized z-score is in the display, you

hp calculators -3- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

would press :s<<II. The final I (a final = works just as well) is necessary to have the
HP 30b execute the function instead of just previewing the potential answer.

Note: To enter a < (or > or { or O) function in a program, it is necessary to press :, hold it down and
press the appropriate key (such as < ) before releasing the : key. This will be shown in the program listings as
:+ <.

To enter this series of key presses into a program, you would press the following keys.

: Enters program mode and displays the last program


previously viewed in the program catalog. If you wish to
enter your program into a different program number in the
catalog, press > or < until the program number you
wish to use is displayed. Then press:
I Enters program edit mode and displays the first line of the
program, which will be blank as shown at right if this is a
new program. Then press the keys needed to access the
function in the menu. With each key press, the HP 30b will
briefly display the function recorded and move to the next
step location to record the next key press.
:s These key presses will access the normal distribution
:+< probability function in the math menu. The next step would
:+< be step 6 of the program.
II
:+L This keypress enters a STOP command. This command
ends program execution and returns control to the user. The
program advances to show an empty program step number
7, but this will not be used. Press < to scroll through the
steps of the program, which should look like those shown
below.

hp calculators -4- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

To exit program edit mode, press : . This returns the HP 30b to the program catalog and now displays Prgm 0,
showing the program’s 3 digit checksum of 243 and that the program uses 7 bytes of program memory.

One way to run this program is from the program catalog. With Prgm 0 shown in the display, you can enter a z-score for
which you want to have the cumulative probability computed and press ==. This will run the program and return
the result. For example, press 1==. The program runs and displays the result below. Note that running the
program in this way exits the program catalog.

To run the program again, you can re-enter the program catalog, key in another z-score and rerun the program.
However, this is also rather keystroke intensive.
Fortunately, you have the ability to assign a program to a key. Once assigned to a key, pressing the key will
automatically run the program. Suppose you wanted to assign this program to the :f key position. To make this
assignment, re-enter the program catalog by pressing : .

Note: If you assign this program to the :f key position, the random number function is ONLY available if you clear
the program key assignment or if you press: + 1 (shift-hold 1) while in the calculation environment (since the
random number function is the shifted function of the 1 key). If the shift-hold f position (: + 1 ) has ALSO been
assigned to a program, the original functionality of the key position will be unavailable until one of the key assignments
has been cleared. To clear an assignment, press { when program step 0 is displayed.

The program catalog is displayed showing program 0. Press I to begin editing the program. Now press >. This
takes the program listing to step 0, as shown below.

The HP 30b will automatically assign a program to the key represented by the step entered at step 0. With step 0 shown,
press :f to assign this program to that key position on the keyboard. Note that the program step location did not
advance when the program assignment was entered – it stayed on step 0, as shown below.

hp calculators -5- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

Now press <O to exit the program editing environment. To run the program, key in a z-score and press :f.
For example, to compute the area under the normal distribution curve for the z-scores of 1, 0 and 0.5, you can now
press:

1:f then 0:f and then 0.5:f. You have now extended the HP 30b keyboard by
placing the normal distribution probability function on the keyboard at the location :f. This saves a large number
of key presses and is actually very easy to do.

Example 2: The HP 30b has the three basic trigonometry functions, sine, cosine and tangent on the keyboard. The
inverse trigonometry functions are in the Math menu, however, as shown below. If you need to use the inverse
trigonometry functions often, you can assign these functions to the “shift hold” positions of the three trigonometry
functions that are on the keyboard. You can visualize this by looking at the HP 30b keyboard. Every key except the shift
key itself has two functions: the function printed on the top of the key and the blue function written on the front slope of
the key. Each of these two locations can be “assigned” as the starting key for a program. In addition, you can define
assignments of programs to the shift and hold key position as well. In this example, we will assign the inverse sine
function to the shift-hold 7 key. To access that function, you would press : and while holding it down, press 7.

To automate this type of function found in a menu, make a list of the exact keys pressed to access the function
manually. These key presses will be entered in the program. To perform an inverse sine, you would press

hp calculators -6- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

:sI<I. The final I (a final = works just as well) is necessary to have the HP 30b execute
the function instead of just previewing the potential answer.

To enter this series of key presses into a program, you would press the following keys.

: Enters program mode and displays the last program


previously viewed in the program catalog. Since Prgm 0 was
used before, press < until program number 2 is
displayed. Then press:
I Enters program edit mode and displays the first line of the
program, which will be blank as shown at right since this is a
new program. Then press the keys needed to access the
function in the menu.
:s These key presses will access the inverse sine function
I in the Math menu. The next step would be step 5.
:+<
I

:+L This key press enters a STOP command. This command


ends program execution and returns control to the user.
Press < to scroll through the steps of the program, which
should look like those shown below.

To exit program edit mode, press : . This returns the HP 30b to the program catalog and now displays Prgm 1.
The number of bytes used by Prgm 1 is shown below it in the display. The automation program uses 6 bytes of memory
and has a checksum of 047.

To assign this program to the :+ 7 key position, enter the program catalog by pressing : . Press > to
view step 0 of this program where the key assignment will be entered. To assign this program to the :+ 7 key
position, press :+ 7. The display should appear as shown below. SH7 stands for “shift-hold 7” which is the shift-
hold sine function position.

hp calculators -7- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

Press <O to exit the program edit mode and return to calculation mode. Assuming the calculator is in the degrees
angle mode, calculate the sine of a 25 degree angle by pressing 25:p. The display should appear as
shown below.

To find the angle again by executing the inverse sine function, press : + 7. The display should appear as shown
below.

Note that in this example, an assignment was made to a key position that already had a shift-hold function assigned to it
by the HP 30b itself: the CALL programming environment function. In the calculation environment, the inverse sine
program assignment will be executed. If you press this shift-hold key position while editing a program, the CALL function
will be entered into the program, since that assignment is active in program mode.

Example 3: Change the previous program so that step 1 contains the MSG “INV SIN” so that the program will show
those characters as a title in the program catalog listing. Remember that to move the character position to a numeric digit
as a letter in a message, press the corresponding numeric key. To move to an =, press =. Pressing . moves to the
? character. Pressing } moves the character position to a space. The arithmetic operators move the character position
to the corresponding operator character. Press I to select the displayed character and prepare to enter another
character. Press O to select the displayed character and terminate character entry. A maximum of 8 characters may
be entered as a message.
To modify the program, do the following.

: Enters program mode and displays the last program


previously viewed in the program catalog. Since Prgm 1 was
used before, it is displayed again. It is shown in “reverse
video” to indicate that it is assigned to a key. Then press:
I Enters program edit mode and the first line of Prgm 1, the
command to enter the Math menu. Then press:

:+9 Inserts the MSG command at the presently displayed


position. Begins by showing an “A” in the display. Press the
following keys to enter the message “INV SIN”:

hp calculators -8- HP 30b Programming – Automating Tasks - Version 1.0


hp calculators

HP 30b Programming - Automating Tasks

:+> Moves character position to display an “I”


<<

I Enters the “I” character and presents a lowercase


:+< “a” after pressing the I key.
:+< Moves character position to show “N”
>

I Enters the “N” character.


:+< Moves character position to show “V”
<
I Enters the “V” character.
} Moves character position to a space, which is
present but not visible in the image at right.

I Enters the space character into the string.


:+< Moves character position to “S”
<<<<

I Enters the “S” character into the string.


:+< Moves character position to “I”
:+<
<<<<
I Enters the “I” character into the string.
:+< Moves character position to “N”
:+<
>
Press O to terminate entering the message. The display will shift to show line 2 of the program. Now view the program
once again in the program catalog by pressing : .

Although this takes some key presses to input, some users will find this ability to give a title to a program very useful, as
the function of the program will be much more evident from “INV SIN” being displayed in the program catalog than the
generic “Prgm 2”. The title is displayed in “reverse video” because this program is assigned to a key from example 2.
Note that inserting the MSG to give this program a title used an additional 9 bytes of memory (15 – 6 from the previous
example). Remember that if you make a mistake while entering a MSG, you can press { at any time before you press
O and the character at the end of the message will be deleted. Note that the MSG command is perhaps most useful to
enter a string of characters in a program to display a prompt to the user before the program stops for input. This
prompting message can help the user know what values to enter before resuming program execution. The use of the
MSG command here to give a title to a program in the program catalog is simply another use of this function.

hp calculators -9- HP 30b Programming – Automating Tasks - Version 1.0

You might also like