HP 12c Owners Manual
Here you can view all the pages of manual HP 12c Owners Manual. The HP manuals for Calculator are available online for free. You can easily download all the documents as PDF.
Page 101
Section 8: Programming Basics 101 File name: hp 12c_users guide_English_HDPMBF12E44 Page: 101 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm If the duration of the pause is not long enough to write down the number displayed, you can prolong it by using more than one u instruction. Alternatively, you can have the program automatically stop as described next. Stopping Program Execution Stopping Program Execution Automatically. Program execution is automatically halted...
Page 102
102 Section 8: Programming Basics File name: hp 12c_users guide_English_HDPMBF12E44 Page: 102 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Keystrokes Display 24\85 85. Third item. t 2,040.00 AMOUNT for third item. t 137.70 TAX for third item. t 2,177.70 TOTAL for third item. 5\345 345. Fourth item. t 1,725.00 AMOUNT for fourth item. t 116.44 TAX for fourth item. t 1,841.44 TOTAL for fourth item. :1 5,967.70 Sum of AMOUNT column. :2 402.82 Sum of TAX...
Page 103
103 File name: hp 12c_users guide_English_HDPMBF12E44 Page: 103 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Section 9 Branching and Looping Although the instructions in a program normally are executed in order of their program line numbers, in some situations it is desirable to have program execution transfer or “branch” to a program line that is not the next line in program memory. Branching also makes it possible to automatically execute portions of a program more...
Page 104
104 Section 9: Branching and Looping File name: hp 12c_users guide_English_HDPMBF12E44 Page: 104 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Looping If a i instruction specifies a lower-numbered line in program memory, the instructions in the program lines between the specified line and the i instruction will be executed repeatedly. As can be seen in the illustration above under Simple Branching, once the program begins executing the “loop” it will execute it again...
Page 105
Section 9: Branching and Looping 105 File name: hp 12c_users guide_English_HDPMBF12E44 Page: 105 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Keystrokes Display :0 02- 45 0Recalls the number of payments to be amortized. This program line is the one to which pro gram execution will later branch. It is included because after the first time the loop is executed, the number in the “display” * is replaced by the result of ! . f! 03- 42 11Amortizes payment(s)....
Page 106
106 Section 9: Branching and Looping File name: hp 12c_users guide_English_HDPMBF12E44 Page: 106 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Keystrokes Display Ê 02- 45 0Line 02: : 0. This is the beginning of the first pass through the loop. 1.00 Ê 03- 42 11Line 03: f! . –531.25 Portion of first month’s payment applied to interest. Ê 04- 43 31Line 04: gu . –531.25 Ê 05- 34Line 05: ~ . –12.10 Portion of first month’s payment applied to...
Page 107
Section 9: Branching and Looping 107 File name: hp 12c_users guide_English_HDPMBF12E44 Page: 107 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Keystrokes Display Ê 07- 43, 33 02Line 07: gi 02. This is the end of the second pass through the loop. –12.23 t –530.99 Portion of third month’s payment applied to interest. –12.36 Portion of third month’s payment applied to principal. t(or any key) –12.36 Halts program execution. Conditional Branching Often...
Page 108
108 Section 9: Branching and Looping File name: hp 12c_users guide_English_HDPMBF12E44 Page: 108 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm The program line immediately following that containing the conditional test instruction can contain any instruction; however, the most commonly used instruction there is i . If a i instruction follows a conditional test instruction, program execution branches elsewhere in program memory if the condition is true and continues...
Page 109
Section 9: Branching and Looping 109 File name: hp 12c_users guide_English_HDPMBF12E44 Page: 109 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm We’ll key the income into the display before running the program so that it will be in the X-register when the : 0 instruction in program line 01 is executed. This instruction will place the test value 20,000 in the X-register and (as explained in Appendix A) move the income into the Y-register. The ~ instruction in program...
Page 110
110 Section 9: Branching and Looping File name: hp 12c_users guide_English_HDPMBF12E44 Page: 110 of 209 Printered Date: 2005/7/29 Dimension: 14.8 cm x 21 cm Keystrokes Display gi07 04- 43, 33 07If condition is true, branches to program line 07. :2 05- 45 2If condition is false, recalls 25% tax rate to X-register. gi08 06- 43, 33 08Branches to program line 08. :1 07- 45 1Recalls 20% tax rate to X-register. b 08- 25Calculates tax. fs –12.36 Sets calculator to Run...