hp-support-head-portlet

Actions
Loading...

Welcome to HP Customer Support

hp-contact-secondary-navigation-portlet

Actions
Loading...

hp-share-print-widget-portlet

Actions
Loading...
  • Information
    HP fraudulent caller alert - protect yourself from scams

    Learn what to do if you are contacted by fraudulent callers posing as HP representatives. This could be a scam; do not provide any personal information.

    View article

hp-concentra-wrapper-portlet

Actions
Loading...

HP 32sii Calculator - Designing a Program

Introduction
The following topics show instructions that can be put into a program. The instructions used in a program affect how it appears when it is viewed and how it works when it is run.
Calculator symbol key
The procedures in this document use the following text to represent symbol keys:
Key
Description
Text Representation
Right shift key.
RS
Left-shift key
LS
Program boundaries (LBL and RTN)
If more than one program is to be stored in program memory, then a program needs a label to mark its beginning (such as A01 LBL A) and a return to mark its end (such as A05 RTN).
Notice that the line numbers acquire an A to match their label.
Program labels
Programs and segments of programs (called routines) should start with a label. To record a label, press LS,LBL, then the letter-key.
The label is used as identification for executing a specific program or routine. The label is a single letter from A through Z. The letter keys are used as they are for variables. The same label cannot be assigned more than once (this causes the message DUPLCAT. LBL to display), but a label can use the same letter that a variable uses.
It is possible to have one program (the top one) in memory without any label. However, adjacent programs need a label between them to keep them distinct.
Program line numbers
The letter for the label, such as A01 precedes line numbers. If one label's routine has more than 99 lines, then the line number appears with a decimal point instead of the leftmost number, such as A.01 for line 101 in label A. For more than 199 lines, the line number uses a comma, such as A, 01 for line 201.
Program returns
Programs and subroutines should end with a return instruction. The keystrokes are: RS, then RTN
When a program finishes running, the last RTN instruction returns the program pointer to PRGM TOP, the top of program memory.
Using RPN and equations in programs
Programs can be calculated in the same way the keyboard can be calculated on:
  • Using RPN operations
  • Using equations
While a series of RPN operations can be used to calculate the area of a circle, an equation in the program can also be used.
Many programs are a combination of RPN and equations, using the strengths of both.
Strengths of RPN Operations
Strengths of Equations
Use less memory Execute a bit faster
Easier to write and read Can automatically prompt
When a program executes a line containing an equation, the equation is evaluated in the same way the XEQ evaluates an equation in the equation list. For program evaluation, "=" is essentially treated as "-". (There is no programmable equivalent to ENTER for an assignment equation--other than writing the equation as an expression, then using STO to store the value in a variable.)
In both types of calculations RPN instructions can be included to control input, output, and program flow.
Data input and output
The method the program uses to enter and return information can be determined for programs that need more than one input or for programs that return more than one output.
For input, prompt for a variable with the INPUT instruction. Get an equation to prompt for its variables or take values entered in advance onto the stack.
For output, display a variable with the VIEW instruction. Display a message derived from an equation or leave unmarked values on the stack.

hp-feedback-input-portlet

Actions
Loading...

hp-online-communities-portlet

Actions
Loading...

Ask the community!


Support Forum

Support Forum

Join the conversation! Find Solutions, ask questions, and share advice with other HP product owners. Visit now


hp-feedback-banner-portlet

Actions
Loading...

hp-country-locator-portlet

Actions
Loading...
Country: Flag United States

hp-detect-load-my-device-portlet

Actions
Loading...