Graphing calculator.

Contents
Contents........................................................................................................................................................................................ 1
1. RPL Programming................................................................................................................................................................. 1-1
Understanding Programming .............................................................................................................................................1-1
The Contents of a Program ......................................................................................................................................... 1-1
Calculations in a Program ........................................................................................................................................... 1-2
Entering and Executing Programs......................................................................................................................................1-3
Viewing and Editing Programs ..........................................................................................................................................1-6
Creating Programs on a Computer .....................................................................................................................................1-7
Using Local Variables........................................................................................................................................................1-7
Creating Local Variables............................................................................................................................................. 1-7
Evaluating Local Names ............................................................................................................................................. 1-8
Defining the Scope of Local Variables ....................................................................................................................... 1-9
Compiled Local Variables......................................................................................................................................... 1-10
Creating User-Defined Functions as Programs......................................................................................................... 1-10
Using Tests and Conditional Structures ...........................................................................................................................1-11
Testing Conditions .................................................................................................................................................... 1-11
Using Conditional Structures and Commands .......................................................................................................... 1-13
Using Loop Structures......................................................................................................................................................1-17
Using Definite Loop Structures ................................................................................................................................ 1-17
Using Indefinite Loop Structures .............................................................................................................................. 1-21
Using Loop Counters ................................................................................................................................................ 1-24
Using Summations Instead of Loops ........................................................................................................................ 1-25
Using Flags.......................................................................................................................................................................1-25
Types of Flags........................................................................................................................................................... 1-26
Setting, Clearing, and Testing Flags ......................................................................................................................... 1-26
Recalling and Storing the Flag States ....................................................................................................................... 1-27
Using Subroutines ............................................................................................................................................................1-28
Single-Stepping through a Program .................................................................................................................................1-29
Trapping Errors ................................................................................................................................................................1-32
Causing and Analyzing Errors .................................................................................................................................. 1-32
Making an Error Trap ............................................................................................................................................... 1-33
Input .................................................................................................................................................................................1-35
Data Input Commands............................................................................................................................................... 1-35
Using PROMPT ... CONT for Input ........................................................................................................................ 1-35
Using DISP FREEZE HALT ... CONT for Input .................................................................................................... 1-37
Using INPUT ... ENTER for Input .......................................................................................................................... 1-38
Using INFORM and CHOOSE for Input.................................................................................................................. 1-42
Beeping to Get Attention .......................................................................................................................................... 1-45
Stopping a Program for Keystroke Input .........................................................................................................................1-46
Using WAIT for Keystroke Input ............................................................................................................................. 1-46
Using KEY for Keystroke Input ............................................................................................................................... 1-46
Output ....................................................................................................................................................................... 1-46
Data Output Commands............................................................................................................................................ 1-47
Labeling Output with Tags ....................................................................................................................................... 1-47
Labeling and Displaying Output as Strings .............................................................................................................. 1-48
Pausing to Display Output ........................................................................................................................................ 1-48
Using MSGBOX to Display Output ......................................................................................................................... 1-49
Using Menus for Input .............................................................................................................................................. 1-50
Using Menus to Run Programs ................................................................................................................................. 1-50
Turning Off the hp49g+/hp48gII from a Program ...........................................................................................................1-52
2. RPL Programming Examples ................................................................................................................................................ 2-1
Fibonacci Numbers ............................................................................................................................................................2-1
Contents -1