|
A program is nothing more than 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-32 calculator programming.
To get you started, try entering and executing the sample program shown on the Info screen of RPN-32 CE (double-tap the calculator name at the bottom).
Entering and running a program
- Tap P/R to enter program mode
- To clear the program memory, tap f PROG
- Enter your program steps
- Tap P/R to return to run mode.
If you haven't turned off "f ENTER in RUN Mode" in Settings, line 00 is automatically selected.
Otherwise, tap f TOP.
- Tap R/S to run the program
Reviewing your program
- Tap P/R to re-enter program mode.
- Tap SST to single-step through your program lines.
Likewise, use BST to back-step.
- Alternatively, tap the display in program mode to see the entire listing.
Debugging your program
- Tap SST in run mode to execute your program step-by-step.
- While the SST key is depressed, the display shows the instruction about to be executed.
- After the step is executed, the next step number appears shortly at the left.
- Use BST to back-step without executing the steps.
Editing your program
- To insert a step after the current step, simply enter the desired key or keys.
- To delete a step, tap DEL
You may also delete steps directly in the program listing (see picture at right).
- To delete all steps from the current to the end, tap f DLEnd
- To delete a range of steps
In RUN mode, enter the range in X and Y.
Return to PRGM mode and tap g DLx,y
- To find a 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).
Adding or removing steps will automatically adjust all affected GTO commands.
For example, if you enter GTO 40 after step 10 to branch to line 40, what gets stored is GTO 41, since your 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.
Indirect Addressing (STi, RCi)
- All 20 registers plus LSTx may be accessed indirectly via R.9.
- Indirect addressing may be enabled/disabled by pressing f ENTER
(if switch f ENTER in RUN Mode in Settings is set to ON)
- Store the desired register number in R.9, then execute
STi to store x in that register, RCi to recall it
- STi is performed by the key sequence g f, and RCi by f g
- The indirection register R.9 may contain any value in the range 0..20.
Sign and decimal digits are ignored.
- R20 is the LSTx register.
Note that the indirection register R.9 may be incremented, decremented and tested by the loop control instructions DSE and ISG.
Example program 1 – Sum of 1 to x
- Enter the first 9 steps of the program shown at right (top).
- After tapping P/R to return to run mode, step 00 should be addressed. If in doubt, tap the display and check
the entry labeled Line in the register view. There are several ways to go to step 0: tap P/R twice, or execute GTO 00, or execute f PROG.
- 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
(Caution: Large values of x will cause RPN-32 CE to become unresponsive.)
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-32 opens.
OR
- Open the file in any text editor. Select the text and copy. Open RPN-32.
- In RPN-32, tap P/R to enter program mode and paste.
- Tap P/R to return 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
When inserting or deleting program steps, RPN-32 automatically readjusts all affected GTO and GSB
branch instructions. This huge time-saver is not entirely free of pitfalls.
For details, click here.
|
|
|
|
Managing programs on RPN-32 CE |
|
|
|
|
|
|
|
Use P/R to select program 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-32's Documents folder on your iPhone under the name you've given it as title.
- If desired, use iTunes File Sharing to copy the program to your computer for archiving.
|
|
|
|
|
|
|
|
- Programs may have any name as long as the extension .rpn32 is preserved.
|
|
|
|
|
|
|
|
Importing a program |
|
|
|
To import a program from the Documents folder:
- Tap Programs
- You'll be presented with a list of all your programs,
followed by the sample programs.
- Pick a program and tap Import.
or
Double-tap a program.
- If the program was stored with registers, you have several options:
• Import program and settings only
• Import program and primary registers R0..R9
• Import program and secondary registers R.0..R.9
• Import program and all 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.
Note:
An empty program saved with registers will only replace the registers, leaving the program memory untouched.
This feature may be used to create pure data files.
|
|
|
|
|
|
|
|
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.
|
|