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...

hp-concentra-wrapper-portlet

Actions
Loading...

HP 12c Platinum Financial Calculator - Writing a Small Program

Why write programs?
The HP 12c Platinum resources are complete and powerful enough to solve almost any financial and business related problem. In some situations, a small, predefined sequence of custom-selected functions (called a program) becomes a handy tool to enhance productivity and to reduce the number of errors due to repeated keystroke usage. In general, creating a program is grouping a set of selected functions from the keyboard in a predefined sequence and storing this set in the calculator memory. This sequence can be easily executed later, as many times as needed and whenever needed.
What are keycodes?
Each key in the calculator keyboard is given an internal code. When a key is pressed and its code is identified by the calculator’s internal circuits, many operations are performed and the result from these operations is usually returned to the display.
  note:
Some operations do not return numbers to the display, like setting a particular operation mode, checking for available memory or pressing keys while writing a program.
As a program is essentially a sequence of keycodes recorded for later execution. When a program is executed, the calculator reacts as if a keystroke sequence is performed. Each keycode is composed of a pair of single digits, where the first one refers to a row and the second one refers to a column on the keyboard. These row and column references define the position of the corresponding key on the keyboard.
  note:
Except for the key (no keycode) and the number keys to that have a one-digit code matching the number printed on them.
In most cases, one program line holds more than one keycode.
Figure : Displaying the program step number 002 and the keycode
This is a typical program line. The leftmost code '002' is the program step number and the other number is the keycode. '22' means second row (up to down) and second column (left to right): this is the key. This means that line '002' contains the code for , and when the program is executed, is the operation performed.
Figure : Displaying the program step number 003 and the keycode
This is another program line showing more than one keycode. This is the program step number '003', and '43' means fourth row (up to down) and third column (left to right): the (blue prefix) key. '22' means second row and second column, or the key. This means that line '003' contains the codes for the keystroke , which is the function.
Figure : Displaying program line numbered 003 with the keycode 43 2
Figure 3 illustrates the reference to a program line numbered '003' with the keycode '43 2', which means .
Converting keystrokes into programs
Each complete keycode in a program composes a program line, and each program line is automatically given a number, or a label. A program will hold as many lines (up to 399 in the HP 12c Platinum) as keyed in to perform the calculation it is meant for. A program must also end with a specific code that stops its execution. In most cases, a known sequence of keystrokes that are used to manually solve a problem is enough to generate a program. Simply put the calculator in program mode by pressing and press the keys as if the problem is solved manually. When it is finished, press again to return to normal mode. In some cases it is necessary to add a few extra keystrokes to complete the program, like , or . Whenever the program is needed, simply enter the necessary data and press .
Practice writing a small program
Example 1
An industry wants to set the final cost for products given their production costs. In some cases, the product cost is added 15% plus a fixed $1.22. Write a small program that, by hitting only the key, calculates the product final cost given the summation of production costs. Then use the program to find the final cost of the products with the following production costs: $33.00, $37.00, $42.50, $48.00 and $51.25.
Solution
One of the keystroke sequences that can be used to calculate the final cost given the production costs is:
To clear any program previously written and write the program that performs these calculations, press:
Keystroke
Display
Figure : Clearing previously written programs
The calculator is now in program mode and program memory is cleared. The display shows the 'PRGM' annunciator to indicate it is in program mode, and line '000', that cannot contain keycodes. Press the following keys and observe the changes in the display:
Keystroke
Display
Figure : Displaying the program step number 001 and the keycode 40
Figure : Displaying the program step number 002 and the keycode 1
Figure : Displaying the program step number 003 and the keycode 5
Figure : Displaying the program step number 004 and the keycode 25
Figure : Displaying the program step number 005 and the keycode 40
Figure : Displaying the program step number 006 and the keycode 1
Figure : Displaying the program step number 007 and the keycode 48
Figure : Displaying the program step number 008 and the keycode 2
Figure : Displaying the program step number 009 and the keycode 2
Figure : Displaying the program step number 010 and the keycode 40
Now put the calculator back in normal mode and set program counter to step 00.
The display shows previous contents. Now compute the first final price:
Keystroke
Display
Figure : Calculating the first final price
The same keystroke sequence with the next data applies to the others:
Keystroke
Display
Figure : Entering the next value to calculate the final price
To check for the other values:
Figure : Entering the next set of values to calculate the cost price
Answer
One of the programs that performs these calculations is listed below:
Figure : Program to calculate the final cost
Example 2
There are many investments to be calculated in your office, and one of the calculations to be done several times is converting continuous nominal rate to effective rate. Write a small program that given a continuous nominal rate returns the effective rate only by hitting key. Then use the program to find the effective rates for these continuous nominal rates: 10.5%, 17.2%, 11.8%, 10.24% and 11.5%. Assume RPN mode.
Solution
The keystroke sequence that calculates effective nominal rate given a continuous nominal rate is:
To write the program that performs the same operations, press:
Figure : Calculating the effective nominal rate given a continuous nominal rate
The display shows previous results.
Answer
After the program is loaded, simply enter each continuous rate and press key to obtain the effective rate.
Figure : Calculating the effective rate from the continuous nominal rate
Going further and additional information
This is a glimpse of what can be done with programs. The HP 12c Platinum programming tools allow the user to:
  • Execute and review programs one step at a time with the use of and ;
  • Edit programs to correct for errors and add new lines;
  • Add any available function as program steps in order to create programs with enhanced complexity;
  • Enhance program efficiency with stack manipulation functions and register storage/retrieval/arithmetic;
  • Add conditional procedures or jumps () after tests for two conditions: and .
Any additional information and in-deep examples can be found in the HP 12c Platinum Owner's Handbook and Programming Guide, parts II and III plus the Appendix A, and in the HP 12c Platinum Solutions Handbook. Also, see the learning module on Programming in Algebraic vs. RPN Modes.

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: Hong Kong

hp-detect-load-my-device-portlet

Actions
Loading...