Post Reply 
HP 12C Basic Programming
09-09-2024, 06:53 AM (This post was last modified: 09-09-2024 07:21 AM by C.Ret.)
Post: #3
RE: HP 12C Basic Programming
Bonjour,

The example given by Steve Simpkin is the best implementation for three independent programs to reside in the single program memory area of ​​the HP-12C.
Indeed, unlike other Voyagers more suited to this situation, the HP-12C lacks any user labels.

The best way to manage this situation is indeed to use a sequence g GTO nn R/S to launch each program where nn corresponds to the first step of the destination program.

This situation, which therefore requires typing a certain number of keys, can quickly become annoying with a large amount of data and slow down operations… or even call into question the practical interest of using a program!

Below I put the keystroke's counts according to three scenarios:
Code:
Program entry (16 steps)     {31}    No program                        No program              0             DISPLAYED RESULTS:    
                                                                       123 STO 1 456 STO2    {10}  
123 ENTER 456 g GTO 01 R/S   {12}    123 ENTER 456 x EEX 2 +   {11}     x  EEX 2 +           { 4}             56,188.00
123 ENTER 456 g GTO 07 R/S   {12}    123 ENTER 456 / EEX 2 -   {11}    RCL 1 RCL 2 / EEX 2 - { 8}            -99.73
123 ENTER 456 g GTO 13 R/S   {12}    123 ENTER 456 +  5  /     { 9}    RCL 1 RCL 2 + 5 /     { 7}             115.80
                              36 keystrokes +31                 31 keystrokes                 29 keystrokes

As we can see easiness greatly depend of the situations.

If it happens that the two numbers are identical, obtaining the results of the three programs can require a lot of keystrokes with the use of the three programs launched by their respective GTO.

In, this perhaps irrelevant case, where the two numbers are often the same for the three programs, it may be more judicious to consider a single program that gives the three results in sequence. In this case, and unique if we are mainly dealing with the same two numbers from which we want to have one or often more results from the three programs, the following example may be more appropriate:

CODE:
Press f P/R f CLEAR PRGM to enter Program Mode, clear Program memory and enter following programming from scratch
Code:
01-   44 2   STO 2                  10-   45 1   RCL 1                  17-   45 1   RCL 1
02-     34   x⇋y                   11-   45 2   RCL 2                  18-   45 2   RCL 2
03-   44 1   STO 1                  12-     10    ÷                     19-     40    +
04-   45 2   RCL 2                  13-     26   EEX                    20-      5    5 
05-     20    ×                     14-      2    2                     21-     10    ÷
06-     26   EEX                    15-     30    -                     22-     31   R/S     result PRG#3
07-      2    2                     16-     31   R/S    result PRG#2
08-     40    +                                                         23-   45 1   RCL 1
09-     31   R/S    result PRG#1                                        24-43,33 4 g GTO 04  back to PRG#1
Press f P/R again to go back to RUN Mode

This program is longer and uses two memory registers.

But in some cases, it may be more appropriate (or not), depending on the number of data to be processed for which the user want to compare or obtain the results of more than one of the three programs.

Its principle is to take the two numbers entered by the user in the X: and Y: registers and to successively display the result for each of the three programs. It also place the successive results in the stack in order.
To move to the next display, the user only needs to press the R/S key.

Typical use: only 11 keystrokes
123 f CLEAR PRGM 456 R/S display 56,188.00 (result PRG#1)
Pressing R/S again display -99.73 (result PRG#2)
Next R/S display 115.80 (result PRG#3)

Now the stack contain Z: 56,188.00 Y:-99.73 and X: 115.80
If the user press an extra time on R/S, the program loops and re-display result of PRG#1.

The mandatory f CLEAR RPGM keystrokes advantageously remplace pressing ENTER since it also reset the PC counter to the beginning of the code.

Not all R/S presses are needed: one may stop as soon as he get the result of the specific program number needed.

I hope this helps somewhat to better consider the multiple possible solutions and their disadvantages in the case of a situation where multiple programs are needed by the user of an HP-12C.

Of course, for my point of view, the exemple given by Steve Simpkin is certainly the best and more general practical solution.
Despite using another Voyager model such as the HP-11C or HP-15C Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 12C Basic Programming - avsebastian - 09-09-2024, 02:51 AM
RE: HP 12C Basic Programming - C.Ret - 09-09-2024 06:53 AM
RE: HP 12C Basic Programming - avsebastian - 09-11-2024, 01:31 AM



User(s) browsing this thread: 1 Guest(s)