Download Print this page

HP 33S User Manual page 9

Hp calculators
Hide thumbs Also See for 33S:

Advertisement

hp calculators
HP 33S Writing a Simple Program
Answer:
The program works correctly in RPN and in algebraic modes, even for the special case where x is 0.
Furthermore, it works so that the original value of x can be recovered with the Í key.
The program is 42 bytes long and its checksum is D11C. At 13 steps, it is longer than the "area of a circle"
program, but not very long. Extra steps were needed to make it work for the special case, and to use a data
register for the calculation, so the program works both in RPN mode and in algebraic mode. This means
that the program can be used by other programs that need to calculate sinc.
Using a program in another program
Example 4: Use program C, written above, to calculate a sinc function value inside another program.
Solution:
This is very similar to writing a program which calculates a sine as part of a longer calculation. A program
which needs to calculate the sine of 1.3 radians might have the following lines in it:
D0001
D0002
D0003
D0004
D0005
A program to use the sinc function, provided by program C, would look like this instead:
D0001
D0002
D0003
D0004
D0005
As this shows, if another program needs to calculate a sinc value, it can use program C like an HP 33S
function. First the number x is typed. Then, Instead of typing a function name, the user must call the sinc
program by typing XEQ C. When the calling program is run the sinc program will do its calculation. When
that reaches the RTN at its end, it will return to the program that called it, which will continue from the next
line. When a program is called from another program like this, it is called a subprogram or a subroutine.
If a program is used as a subroutine, called from another program, then the RTN at its end finishes the
subroutine and goes back to the program that called the subroutine. As was explained in the section on
tools for programming, if a program is not called up from another program, but is started by the user
pressing ¥, or t, then the Ô goes back to the top of program memory, where the program
stops.
Programs can do much more than has been described in this training aid. The reader should consult the
HP 33S manual and try some of the many example programs in it.
hp calculators
LBL D
RAD
1.3
sin
... more program lines ...
LBL D
RAD
1.3
XEQ C
... more program lines ...
- 9 -
HP 33S Writing a Simple Program - Version 1.0

Advertisement

loading