HP 39 Programming
An HP 38g, HP 39g, HP39g+ and HP40g program contains a sequence of numbers, mathematical expressions, and commands that execute automatically to perform a task. These items are each separated by a colon. Commands that take multiple arguments have those arguments separated by a semicolon. Inside a program, branching structures can be used to control the execution flow. Creating building-block programs enables structured programming to be used. Each building-block program stands alone and can be called from other programs.
The main function is the program catalog. This is where programs are created, edited, deleted, sent, received, or run. To open the PROGRAM CATALOG press SHIFT, then PROGRAM. The program catalog displays a list of program names (see right insert). If no programs have been created, the only name that will be seen is EDITLINE. The EDITLINE contains the last expression that was entered from the edit line in HOME, or the last data that was entered in an input form. (In the HOME menu, if ENTER is pressed without entering any data, the HP 3X runs the contents of the EDITLINE).
Creating a new program
To create a new program:
-
Press SHIFT, then PROGRAM to open the PROGRAM CATALOG.
-
Press NEW (the HP 39g/40g will ask for a name).
-
Type the program name, then press OK
-
Enter the program. When done, start any other activity. The work is saved automatically.
NOTE: A program name can contain special characters, such as a space. However, if special characters are used, and the program is ran by typing in HOME, the program name must be enclosed in double quotes (’ ‘). Do not use the quotation mark symbol within the program name.
Entering commands
While gaining a familiarity with the HP 39g/40g commands, the easiest way to enter commands is to use the commands menu from the PROGRAM EDITOR. Commands can also be typed in using alpha characters. To enter a command:
-
From the PROGRAM EDITOR, press SHIFT, then CMDS to open the PROGRAM COMMANDS menu.
-
On the left, use the cursor-up or cursor-down keys to highlight a command category, then press cursor-right to access the desired command.
-
Press OK to paste the command into the PROGRAM EDITOR.
Editing program
To edit a program:
-
Press SHIFT, then PROGRAM to open the PROGRAM CATALOG.
-
Use the cursor keys to highlight the program that is to be edited and press EDIT (the HP 39g/40g opens the PROGRAM EDITOR. The name of the program will appear in the title bar on the display).