Post Reply 
HP 12C Basic Programming
09-09-2024, 02:51 AM
Post: #1
HP 12C Basic Programming
Hello .

I have in my hands an old Brazilian hp 12C calculator.

I'm not a fan of 12C calculators, but now I'm hating it, hahaha.

And that is because of its "programming".

I want to make three very simple and independent programs (no loops, subroutines or anything like that) and store them in the calculator. To understand how to save and run the programs on this calculator

I have accessed the manual in Spanish, but it has not worked for me (or worse, I fear that there is a problem with the calculator)

One of the programs is that given 2 numbers, multiply them, and add 100.

Another program is that given 2 numbers, divide them and subtract 100.

And another program is to add them and divide them by 5.

The issue, if you can help me, is what steps I should write in the programs?. And how can I run the third program, or the second?. Because so far,the only thing I've ever done is run the first program, and not the second and third.

Thanks!!

Today: [Graphics: hp 48G / hp 50G / TI 89 Titanium] [Business: hp 10BII+ / hp 17 BII /hp 12C ] [Scientific: Casio fx 570 ES plus 2nd Edition]



Find all posts by this user
Quote this message in a reply
09-09-2024, 03:58 AM (This post was last modified: 09-09-2024 03:59 AM by Steve Simpkin.)
Post: #2
RE: HP 12C Basic Programming
The following is one example of doing what you described.

Go to Program Mode (f, P/R), press f, PRGM to clear program memory and enter the following 16 step program:

01 X
02 1
03 0
04 0
05 +
06 g, GTO 00
07 /
08 1
09 0
10 0
11 -
12 g, GTO 00
13 +
14 5
15 /
16 g, GTO 00
(note this last step should already be present if you had cleared PRGM memory)

Press f, P/R to go to Run Mode.


Usage example:
Type in number 1 and press ENTER.
Type in number 2.

To run program 1, press the following in Run Mode:
g, GTO 01 R/S

To run program 2, press the following in Run Mode:
g, GTO 07 R/S

To run program 3, press the following in Run Mode:
g, GTO 13 R/S
Visit this user's website Find all posts by this user
Quote this message in a reply
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
09-11-2024, 01:31 AM
Post: #4
RE: HP 12C Basic Programming
Thanks, Steve Simpkin and C.Ret.

Today: [Graphics: hp 48G / hp 50G / TI 89 Titanium] [Business: hp 10BII+ / hp 17 BII /hp 12C ] [Scientific: Casio fx 570 ES plus 2nd Edition]



Find all posts by this user
Quote this message in a reply
09-11-2024, 10:43 AM (This post was last modified: 09-11-2024 10:46 AM by Nihotte(lma).)
Post: #5
RE: HP 12C Basic Programming


Hello everyone,

I would also like to add a little programming tip that has often been useful for the HP12C Platinum and its large memory:

I establish a small summary at the start of the program area
which allows me to jump to the correct program line depending on the choice I make.

This gives this for the solution provided by Steve Simpkin:

Code:

01 g, GTO 04
02 g, GTO 10
03 g, GTO 16
04 X
05 1
06 0
07 0
08 +
09 g, GTO 00
10 /
11 1
12 0
13 0
14 -
15 g, GTO 00
16 +
17 5
18 /
19 g, GTO 00

Afterwards,
- to launch program #1, I use the GTO 01 R/S
- to launch program #2, I use the GTO 02 R/S
- to launch program #3, I use the GTO 03 R/S

This allows several programs to coexist in the calculator's memory and to call them as needed, as long as we remember their order of presence in memory.

Keep yourself healthy!

Laurent
Find all posts by this user
Quote this message in a reply
09-11-2024, 06:03 PM
Post: #6
RE: HP 12C Basic Programming
(09-11-2024 10:43 AM)Nihotte(lma) Wrote:  ...
Afterwards,
- to launch program #1, I use the GTO 01 R/S
- to launch program #2, I use the GTO 02 R/S
- to launch program #3, I use the GTO 03 R/S

This allows several programs to coexist in the calculator's memory and to call them as needed, as long as we remember their order of presence in memory.

Keep yourself healthy!

Laurent

Laurent, That is a good idea (assuming you can spare the memory) and simplifies running multiple programs in programmable models that do not use labels like the HP-55, HP-25/C, HP-33E/C, HP-38E/C, HP-12C and HP-10C. I used a HP-25 for almost 10 years but rarely had multiple programs loaded in it since they disappeared when I turned it off.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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