EasyManua.ls Logo

HP HP-28S - Programs

HP HP-28S
49 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
HP-28S
Programs
General
A program is a series of commands surrounded by << and >>
brackets. These symbols are located next to the SPACE key.
The programming language is called RPL: Reverse Polish Lisp. It
is stack based with a support for many data types. The HP-28C/S
was the first calculator to use RPL. Later models like the HP-48
and HP-49 used it as well.
Control instructions are described in the CONTRL Menu
Branching instructions are descibed in the BRANCH Menu
Flag manipulation and other program commands are described in
MENU Test
Programs can be stored in variables like other objects.
See Data Types.
There is no GOTO available. Use structured programming instead.
Programs can be interrupted by pressing "ON".
Program example
<<ROT * SWAP 2 / CHS DUP SQ ROT - >> 'QE' STO
Program QE takes 3 input values from the stack which represent
coefficients a, b and c of a quadratic equation.
The program returns two values r1 and r2 on the stack. The two
solutions of the quadratic equation can be calculated as r1+r2
and r1-r2.
Local Variables A program can have local variables.
Using local variables avoids conflicts with global variable names.
Example: << x y <<x y + LN>> >> 'P' STO
This creates the program and stores it in a variable called P.
Important: The SPACE after the "" is required!
The program takes two arguments from the stack and puts them into
the local variables x and y. The return value is ln(x+y).
Example: 1 2 P returns 1.0986…
This program could also be entered in the form of an expression:
<< x y 'LN(x+y)' >> 'P' STO
Both the program and expression form allows to invoke the program
in functional notation.
Example: 'P(1,2)' EVAL also returns 1.0986…
Important: For some reason the sequence P(1,2) ENTER will not
work but rather issue and error.
Editing a
program
Use 'P' VISIT to bring back the program into the command
line for editing.
Use NEWLINE to enter line breaks to make the program code
more readable.
Comparisn
operators
> < == and flag checking commands return either 0 or 1 onto
the stack and can be used to steer branch instructions.
Note that the values to be compared must be present on the stack.
Example: 4 5 > returns 0.
For more details see TEST Menu.
Subroutines Simply specify the name of the program to execute. Example:
<< SQ LN 1 + >> 'P1' STO
<< P1 SWAP P1 + >> 'P2' STO
7

Other manuals for HP HP-28S

Related product manuals