Section 8: Program Branching and Controls
99
In this way, a program can accommodate two different modes of input, such
as degrees and radians, and make the correct calculation for the mode
chosen. You set a flag if a conversion needs to be made, for instance, and
clear it if no conversion is needed.
Suppose you had an equation requiring temperature input in degrees Kelvin,
although sometimes your data might be in degrees Celsius. You could use a
program with a flag to allow either a Kelvin or Celsius input. In part, such a
program might include:
´
bC
Start program at ―C‖ for degrees Celsius.
|
"
7
Flag 7 cleared (=false).
t
1
´
b
Á
Start program at ―D‖ for degrees Kelvin.
|
F
7
Flag 7 set (=true).
´
b
1
(Assuming temperature in X-register.)
|
?
7
Checks for flag 7 (checks for Celsius or Kelvin
input).
t
2
If set (Kelvin input), goes to a later routine, skipping
the next few instructions.
2
If cleared (Celsius input), adds 273 to the
7
value in the X-register, since °K = °C + 273.
3
+
´
b
2
Calculation continues for both modes.
⋮
The System Flags: Flags 8 and 9
Flag 8
. Setting flag 8 will activate Complex mode (described in section 11),
turning on the
C
annunciator. If another method is used to activate Complex
mode, flag 8 will automatically be set. Complex mode is deactivated only
by clearing flag 8; flag 8 is cleared in the same manner as the other flags.
Summary of Contents for HP-15C
Page 1: ...HP 15C Owner s Handbook HP Part Number 00015 90001 Edition 2 4 Sep 2011 ...
Page 17: ...Part l HP 15C Fundamentals ...
Page 64: ......
Page 65: ...Part ll HP 15C Programming ...
Page 118: ...118 ...