Making a Program Wait for Numeric Input
This section explains how to interrupt a program so that you can enter numbers into the program.
Using [ BREAK ] to Enter Numbers
Many problems require you to enter a number after a sequence of keystrokes has already been performed. To solve this type of problem in a program, you need an instruction that:- Interrupts the program at the point where you want to enter the number.
- Permits you to perform manual calculator operations such as entering a number into the display.
- Allows you to continue execution from the point in the program where it was interrupted.
The [ BREAK ] instruction is designed for this purpose.
[ BREAK ] interrupts program execution and defines [ F1 ] as { GO }. By placing a [ BREAK ] instruction in a program, you can stop execution temporarily. When you are ready to restart the program, just press { GO }. If you clear { GO } by pressing a system-menu key before you restart the program, you can restore { GO } by pressing [ BREAK ].
The use of a [ BREAK ] instruction to enter a number into a program is illustrated below.
[ RUN ] { PGM }
... program executes
BRK
Enter Number
{ GO }
... program executes
HLT
Example
Write a program to solve the following problem.Z = SIN X - TAN Y
This problem requires you to enter values for X and Y. Design the program so that you enter X before you run the program and Y after execution starts.
Procedure | Press | Display |
---|---|---|
Activate learn mode | [ LEARN ] { 1st } | |
Clear program | [ 2nd ] [ CP ] | |
Calculate sine | [ SIN ] | |
Subtract | [ - ] | |
Stop for number | [ BREAK ] | |
Calculate tangent | [ TAN ] | |
Final result | [ = ] | |
Stop execution | [ HALT ] | |
Exit learn mode | [ LEARN ] |
Running the Example
Before running the program, set the angle units to grads by pressing [ 2nd ] [ DRG ] until GRAD MODE appears in the display. Then use the program to calculate Z for the following values of X and Y.Value of X | Value of Y |
---|---|
206 Grads | 94 Grads |
45 Grads | 101 Degrees |
Procedure | Press | Display |
---|---|---|
Set grad mode | [ 2nd ] [ DRG ] • | |
Display RUN menu | [ RUN ] | |
Enter X | 206 { PGM } | |
Enter Y | 94 { GO } | |
Display RUN menu | [ RUN ] | |
Enter X | 45 { PGM } | |
Select ANG menu | [ CONV ] { ANG } | |
Enter Y, Convert to grads | 101 { D-G } | |
Redisplay { GO } | [ BREAK ] | |
Restart program | { GO } |
• Repeat until GRAD MODE appears in the display.
Note:
Running a program does not clear calculations in progress. Therefore, if you decide to rerun the program after it has been stopped by the BRK instruction, press [ CLEAR ] first to clear the pending calculation.☚ Back