|
A program is simply a sequence of manual keystrokes that is remembered by the calculator. You can then execute the program as often as you like – typically with just one keystroke. The answer displayed at the end of execution is the same one you would have obtained by pressing the keys one at a time manually. No prior programming experience is necessary for RPN-25 calculator programming.
To get you started, try entering and executing the sample program shown on the Info screen of RPN-25 CE (tap the Info button at the bottom right).
Entering and running a program
- Set the mode switch (top-right) to PRGM to enter program mode
- To clear the program memory, tap f PRGM and confirm.
- Enter your program steps
- Set the mode switch RUN.
If you haven't turned off "Auto-Select Step 00" in Settings, line 00 is automatically selected.
Otherwise, tap f PRGM (or GTO 0 0).
- Tap R/S to run the program
Reviewing your program
- Set PRGM to enter program mode.
- Tap SST to view the next step of your program.
- Tap BST to view the previous step of your program.
Executing BST at step 00 shows the last program step.
- Alternatively, tap the display in program mode to see the entire listing.
Debugging your program
- Set RUN to enter run mode.
- Tap SST to execute your program step-by-step.
- While the SST key is depressed, the display shows the instruction about to be executed.
- Use BST to back-step without executing the steps.
Executing BST at step 00 does nothing.
Editing your program
- To insert a step after the current step, simply enter the desired key or keys.
- To delete the current step in PRGM mode, tap g DEL
You may also delete steps directly in the program listing (see picture at right).
- To delete a range of steps:
In RUN mode, enter the range in X and Y (in any order.)
Tap g DEL
- To select any given step, tap GTO . nn, where nn is the desired step (2 digits).
In RUN mode, the decimal point is not required.
- To find the last step of your program, tap GTO . . (two decimal points).
This works in both RUN and PRGM modes.
Adding or removing steps will automatically adjust all affected GTO and GSB commands.
For example, if you enter GTO 10 after step 03 to branch to line 10, what gets stored is GTO 11, since the GTO instruction
caused the rest of program memory to move down one line.
However, if the GTO's target lies in the unused program area past your last program step, no adjusting takes place.
Example program 1 – Sum of 1 to x
- Enter the first 9 steps of the program shown at right (top).
- After return to RUN mode, step 00 should be addressed (provided Auto-Select Step 00 is activated in Settings.) If in doubt, tap the display and check
the entry in the bottom bar of the register view. There are several ways to go to step 0: activate the mode switch twice,
or execute GTO 00, or execute f PRGM.
- The sample program finds the sum of all integers from 1 to the number in X (display).
This is done by adding x times the value 1 to a register. (Young Carl Friedrich Gauss would simply have calculated x/2 * (x+1), but this program is intended to demonstrate looping.)
Example: Find the sum of all integers from 1 to 100.
Solution: Enter 100, tap R/S. Result: 5050
Example program 2 – Quadratic Equation
- This program is based on "Quadratic Equation" ("HP-25 Application Programs", 1975, by Hewlett-Packard, page 12)
- Download this file: Quadratic Equation
(Note: If you view this on your iPhone, you may want to proceed as shown in the right column here, step 2.)
- If necessary, unzip the file. Then either:
- Send the file to your e-mail account. Long-press the attachment. RPN-25 opens.
OR
- Open the file in any text editor. Select the text and copy. Open RPN-25.
- In RPN-25, switch to PRGM mode and paste.
- Switch back to RUN mode. Step 00 should be addressed. If not, tap f PROG.
Find solutions to the three equations below:
1. x² + x - 6 = 0
2. 2.25x² + 3x + 1 = 0
3. 2x² - 3x + 5 = 0
1.
6 CHS ENTER 1 ENTER R/S
→ 6.2500 (D > 0, so solutions are real)
After 2 seconds:
→ -3.0000 (x₁)
R/S
→ 2.0000 (x₂)
2.
1 ENTER 3 ENTER 2.25 R/S
→ 0.0000 (D = 0, so solutions are real and equal)
After 2 seconds:
→ -0.6667 (x₁)
R/S
→ 0.6667 (x₂)
3.
5 ENTER 3 CHS ENTER 2 R/S
→ -1.9375 (D < 0, so solutions are complex)
After 2 seconds:
→ 0.7500 (u)
R/S
→ 1.3919 (v)
x₁,x₂ = 0.7500 ± 1.3919 i
Using GTOs and GSBs correctly
NOTE: This section applies to regular branches as found on the vintage HP-25. It is highly recommended to make use
of the advanced _GTO, _GSB, and _LBL commands provided by RPN-25 CE instead.
When inserting or deleting program steps, RPN-25 automatically readjusts all affected GTO and GSB
branch instructions. This huge time-saver is not entirely free of pitfalls.
Consider the following simple program that takes the square root of x.
If x is negative, 1 is added to its positive value first.
|
Negative values of x are handled in the subroutine starting at step 05. |
|
|
Deleting CHS at step 05 causes the GSB in step 02 to address the preceding step 04 instead. |
|
|
Restoring the deleted step doesn't change the target of the GSB – the program will not work anymore. |
|
|
The cure:
Start the target of any GTO or GSB branch instruction with a NOP instruction.
Doing so will also allow you to easily insert an instruction before the
first target instruction. |
|
|
Re-targeting the GSB to the original step 05 fixes the program.
RPN-25 identifies NOPs used as branch targets, renaming them to LBL nn (where nn is the step number) and assigning them their own keycode 98. |
|
|
Deleting the GSB instruction transforms the LBL instruction back into an ordinary NOP.
To re-insert the GSB instruction after step 01, enter GSB 04 (not GSB 05, since step 04 is where the NOP is currently located.) |
Data Files
Create, modify and import files that contain register data only (R00..R99.)
This feature allows you to easily run a program with different data sets.
Creating a data file
Any file with no program steps (except GTO 000) is regarded as data file.
To save the current register values (R00..R99) in a data file:
- In PRGM mode, clear the program (f PRGM).
- Tap the display.
- Enter the title and the description.
- Tap Export w/Regs.
Loading a data file
- Import the file just like any program file.
- Only the desired specified register sets are loaded, all other data will be left intact.
- You can also choose to clear all registers.
Editing a data file
To change the title, description and/or any registers of a data file:
- In PRGM mode, clear the program (f PRGM).
- Load the data file with the desired register option.
- In RUN mode, modify registers.
- In PRGM mode, tap the display.
- Edit the title and/or description, if desired.
- Tap Export w/Regs.
|
|
|
|
Managing programs on RPN-25 CE |
|
|
|
|
|
|
|
Use the mode switch to select PRGM mode.
Tap the display to open the program listing.
Note that the current step is highlighted:
|
|
|
|
|
|
|
|
|
|
|
|
Steps may be deleted by swiping left across the line: |
|
|
|
|
|
|
|
|
|
|
|
Tap Save to copy the changed program to the calculator.
To exit without changing the program, tap Cancel.
If you select a line before exiting, the line will be shown on the calculator display.
|
|
|
|
|
|
|
|
|
|
|
|
Exporting a program |
|
|
|
A program may be saved for later use or archiving purposes.
- Tap Programs
- Tap Export
This will save the program, display format, and angular mode.
or
- Tap Export w/Regs
This will save the program, display format, angular mode, and all storage registers.
- The program will be saved in RPN-25's Documents folder on your iPhone under the name you've given it as title.
- Open the Files app to see the programs (On My iPhone / RPN-25 CE)
- On older systems, use iTunes File Sharing to copy the program to your computer for archiving.
|
|
|
|
|
|
|
|
- Programs may have any name as long as the extension .rpn25 is preserved.
|
|
|
|
|
|
|
|
Importing a program |
|
|
|
To import a program and its calculator settings from the Documents folder:
- Tap Programs
- You'll be presented with a list of all your own programs,
followed by the sample programs.
- Hide the sample programs by tapping the eye symbol.
- Apply a filter to quickly find a program.
- Pick a program and tap Import.
–or–
Double-tap a program.
- If the program was stored with registers, you have several options:
• Import program only
• Import program and primary registers R0..R9
• Import program and secondary registers R.0..R.9
• Import program and all 100 registers
- The imported program will replace your current program, including title, description, modification date,
display format, and angular mode.
- If you want to load the imported program into the calculator, be sure to tap Save.
Tap Cancel to ignore the import and return to the calculator.
|
|
|
|
|
|
|
|
Deleting the current program
|
|
|
|
A. To delete the currently stored program and all metadata:
- In the program listing view, tap New.
- Tap Save to send the empty program to the calculator.
or
Tap Cancel to return without any changes.
B. To delete the currently stored program, but keep title and description:
- In the calculator view, tap f PROG (in program mode).
If program memory is not empty, a warning message appears.
|
|
|
|
|
|
|
|
Deleting an exported program |
|
|
|
- In the program listing view, tap Programs
- In the list of stored programs, swipe left across the program name.
or
Tap the red Delete button.
A warning message appears in both cases.
|
|
|
|
|
|
|
|
Printing and PDF creation |
|
|
|
- In the program listing view, tap Print to send the listing to any attached printer.
- Tap P to send the program description to any attached printer.
(The P appears only if the description is not empty.)
- To create a PDF document of the listing or the description:
– Tap Print or P to see the preview
– Long-press the preview. You will see an enlarged view.
– Tap the enlarged view, then tap the Share button in the top-right corner.
|
|
|
|
|
|
|
|
Sample Programs |
|
|
|
Some sample programs have been grouped according to their source. Their identifiers are as follows:
29MA – HP-19C/HP-29C SOLUTIONS - MATHEMATICS
29SE – HP-19C/HP-29C SOLUTIONS - STUDENT ENG.
29SE – HP-19C/HP-29C SOLUTIONS - STUDENT ENG.
41 – HP-41 Programs found here
VxNy – 65 NOTES Volume x Number y
HC – Peter Henrici, "Computational Analysis with the HP-25"
|
|