Last active
October 11, 2021 01:28
-
-
Save henriquegogo/d7f28939ff18b7784e2e7d910fd25623 to your computer and use it in GitHub Desktop.
HP Calculators Programs - SAC for 12c | TVM for 42s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constant Amortization System for HP12C (Platinum) | |
// Author: Henrique Gogó ([email protected]) | |
// | |
// Instructions: enter n, i and PV values and set FV as 0. | |
// Set register 9 if you want to get an specific payment number. | |
// | |
// After program ends, the result saved in registers will be: | |
// X: current payment value | |
// FV: remaining amount to pay | |
// PMT: amortization value (fixed) | |
// 0: current payment interest | |
// 1: current payment number | |
// 2: sum of all payments paid since program started | |
// | |
// You can repeat the program while still have payments to be paid. | |
// If the final payment is reached, the X register will display the final number. | |
// | |
// To start/stop programming, just press "f P/R" at begin and end. | |
// If remaining amount to pay is zero then clear summation | |
001 RCL FV | |
002 g x=0 | |
003 f ∑ | |
// If current payment is the last one then finish program | |
004 RCL 1 | |
005 RCL n | |
006 g x≤y | |
007 g GTO 000 | |
// If remaining amount to pay is zero then set initial amount as remaining amount to pay | |
008 RCL FV | |
009 g x=0 | |
010 RCL PV | |
011 STO FV | |
// Register 0 is the current payment interest | |
012 RCL i | |
013 % | |
014 STO 0 | |
// PMT is the amortization rate | |
015 RCL PV | |
016 RCL n | |
017 ÷ | |
018 STO PMT | |
// FV is the remaining amount to pay | |
019 RCL FV | |
020 x≷y | |
021 - | |
022 STO FV | |
// Increase the summation of payments | |
023 RCL PMT | |
024 RCL 0 | |
025 + | |
026 ∑+ | |
// If current payment number is less than register 9 then repeat program | |
027 RCL 9 | |
028 RCL 1 | |
029 1 | |
030 + | |
031 g x≤y | |
032 g GTO 001 | |
// Show current payment value and finish program | |
033 RCL PMT | |
034 RCL 0 | |
035 + | |
036 g GTO 000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
01 LBL "SAC" | |
02 MVAR "n" | |
03 MVAR "i" | |
04 MVAR "PV" | |
05 MVAR "FV" | |
06 MVAR "PMTn" | |
07 MVAR "PMTi" | |
08 MVAR "PMT" | |
09 LBL 01 | |
10 RCL "FV" | |
11 X=0? | |
12 CLΣ | |
13 RCL 16 | |
14 RCL "n" | |
15 X≤Y? | |
16 GTO 00 | |
17 RCL "FV" | |
18 X=0? | |
19 RCL "PV" | |
20 STO "FV" | |
21 RCL "i" | |
22 % | |
23 STO "PMTi" | |
24 RCL "PV" | |
25 RCL "n" | |
26 ÷ | |
27 STO "PMT" | |
28 RCL "FV" | |
29 X<>Y | |
30 - | |
31 STO "FV" | |
32 RCL "PMT" | |
33 RCL "PMTi" | |
34 + | |
35 Σ+ | |
36 RCL "PMTn" | |
37 RCL 16 | |
38 X<Y? | |
39 GTO 01 | |
40 RCL "PMT" | |
41 RCL "PMTi" | |
42 + | |
43 LBL 00 | |
44 END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
01 LBL "TVM" | |
02 MVAR "n" | |
03 MVAR "i" | |
04 MVAR "PV" | |
05 MVAR "PMT" | |
06 MVAR "FV" | |
07 RCL "i" | |
08 X=0? | |
09 1ᴇ-99 | |
10 1 | |
11 X<>Y | |
12 % | |
13 ENTER | |
14 LN1+X | |
15 RCL× "n" | |
16 E↑X-1 | |
17 STO+ ST Z | |
18 RCL× "PMT" | |
19 X<>Y | |
20 1/X | |
21 × | |
22 X<>Y | |
23 RCL× "PV" | |
24 + | |
25 RCL+ "FV" | |
26 END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment