Interrupting Program Execution. HP 12C Financial Programmable Calculator, 12c - F2230A, 12C#ABA - 12C Financial Calculator, 12C - 12c Financial Calculator, 12c
تبلیغات
تبلیغات
Section 8: Programming Basics 97
Keystrokes Display
Ç
Ç
Ç
Ç
Ç
2. Result of executing program line
02.
03- Program line 03: 5.
25.
Result of executing program line
03.
04-
Program line 04: b
156.25 Result of executing program line
04.
05- Program line 05: -
468.75
Result of executing program line
05.
06-
Program line 06: 5
5. Result of executing program line
06.
07- Program line 07: +
473.75
Result of executing program line
07 (the last line of the program).
Pressing gÜ while the calculator is in Run mode sets the calculator to the previous line in program memory, then displays that line’s number and the keycode of the instruction stored there, just as in Program mode. In Run mode, however, when the Ü key is released the display again shows the same number as it did before gÜ was pressed: no instruction in program memory is executed.
Interrupting Program Execution
Occasionally you’ll want a program to stop executing so that you can see an intermediate result or enter new data. The hp 12c provides two functions for doing so: u (pause) and t (run/stop).
Pausing During Program Execution
When a running program executes a u instruction, program execution halts for about 1 second, then resumes. During the pause, the calculator displays the last result calculated before the u instruction was executed.
If you press any key during a pause, program execution is halted indefinitely. To resume program execution at the program line following that containing the u instruction, press t.
File name: hp 12c_user's guide_English_HDPMBF12E44
Printered Date: 2005/7/29
Page: 97 of 209
Dimension: 14.8 cm x 21 cm
98 Section 8: Programming Basics
Example: Create a program that calculates the entries in the AMOUNT, TAX, and TOTAL columns for each item on the jewelry distributor’s invoice shown on the next page, and also calculates the total in each of these columns for all items on the invoice. Assume the sales tax is 6 3 /
4
%.
To conserve lines of program memory, instead of keying in the tax rate before the b instruction we’ll store it in register R
0
and recall it before the b instruction.
Before storing the program in program memory, we’ll calculate the required amounts for the first item on the invoice manually. The keystroke sequence will use storage register arithmetic (described on page 24) in registers R
1
, R
2
, and R
3
to calculate the column sums. Since these registers are cleared when fCLEAR² is pressed, we’ll press those keys before beginning the manual calculation — and also later, before running the program — to ensure that the column sums are
“initialized” to zero. (Pressing fCLEARH would clear registers R
1
through R
3
, but would also clear R
0
, which will contain the tax rate.)
File name: hp 12c_user's guide_English_HDPMBF12E44
Printered Date: 2005/7/29
Page: 98 of 209
Dimension: 14.8 cm x 21 cm
Section 8: Programming Basics 99
Pressing the gu keys is not necessary when we do the calculations manually, since in Run mode the result of every intermediate calculation is displayed automatically; but we’ll include u instructions in the program so that the intermediate results AMOUNT and TAX are automatically displayed when the program is executed.
Keystrokes Display
6.75?0 fCLEAR²
13
\
6.75
0.00
13.
13.00
Stores tax rate in R
0
.
Clears the registers in R
1
through
R
6
.
Keys in quantity of item.
68.5
§
?+1
68.5
890.50
890.50
Separates quantity of item from cost of item to be keyed in next.
Keys in cost of item.
AMOUNT.
:0 b
?+2
+
?+3
6.75
60.11
60.11
950.61
950.61
Adds AMOUNT to sum of
AMOUNT entries in register R
1
.
Recalls tax rate to display.
TAX.
Adds TAX to sum of TAX entries in register R
2
.
TOTAL.
Adds TOTAL to sum of TOTAL entries in register R
3
.
Now, we’ll store the program in program memory. Do not key in the quantity and cost of each item; these numbers will vary each time the program is run.
Keystrokes Display fs fCLEARÎ
§ gu
?+1
:0 b
00-
Sets calculator to Program mode.
00-
01-
Clears program memory.
43
Pauses to display AMOUNT.
03- 44 40 1
45 0
05-
File name: hp 12c_user's guide_English_HDPMBF12E44
Printered Date: 2005/7/29
Page: 99 of 209
Dimension: 14.8 cm x 21 cm
100 Section 8: Programming Basics
t
:1
:2
:3
Keystrokes Display gu
?+2
+
?+3
43
Pauses to display TAX.
07- 44 40 2
08-
09- 44 40 3
Now, to run the program:
Keystrokes fs fCLEAR²
6.75?0
13\68.5 t
18\72.9 t
24\85 t
5\345
Display
950.61
0.00
68.5
890.50
60.11
950.61
72.9
1,312.20
88.57
1,400.77
85.
2,040.00
137.70
2,177.70
345.
1,725.00
116.44
1,841.44
5,967.70
402.82
6,370.52
Sets calculator to Run mode.
Clears registers R
1
– R
6
.
Stores tax rate.
Enters quantity and price of first item on invoice.
AMOUNT for first item.
TAX for first item.
TOTAL for first item.
Enters quantity and price of second item on invoice.
AMOUNT for second item.
TAX for second item.
TOTAL for second item.
Enters quantity and price of third item on invoice.
AMOUNT for third item.
TAX for third item.
TOTAL for third item.
Enters quantity and price of fourth item on invoice.
AMOUNT for fourth item.
TAX for fourth item.
TOTAL for fourth item.
Sum of AMOUNT column.
Sum of TAX column.
Sum of TOTAL column.
File name: hp 12c_user's guide_English_HDPMBF12E44
Printered Date: 2005/7/29
Page: 100 of 209
Dimension: 14.8 cm x 21 cm
دانلود
تبلیغات
ویژگیهای کلیدی
Financial Pocket Black, Silver
10 digits
Memory registers: 20