Download Print this page

HP 33S User Manual page 6

Hp calculators
Hide thumbs Also See for 33S:

Advertisement

hp calculators
HP 33S Writing a Simple Program
If a user wants to offer a program to other users, the checksum should be given with the program, so the other
users can check if they have entered the program correctly into their HP 33S.
The checksum can be very helpful, but it does not have to be used – for short programs such as the above it can be
enough to step through the program with the up and down arrow keys and correct any mistakes.
Mistakes can be either wrongly typed lines, or missing lines. To add a missing line, use the × and Ø keys until the
line before the missing line is at the bottom of the screen. Then type the missing line or lines. If a line is wrong, move it to
the lower line of the screen and use the ~ key to delete one or more lines, then type the correct line or lines.
Even after all typing errors have been corrected, a program can still be wrong if it was designed wrongly. The HP 33S
manual provides advice on program testing and describes more programming tools.
To go to a line in a program, to see it or to change it, use the GTO command, followed by a dot and then the program
name and the line number. For example to go to line 5 of program A type ¹rËA0005.
The LBL and the RTN help to identify each program. If a program is executed by the user pressing ¥ then the Ô
goes back to the top of program memory, where the program stops. If both program B and program A are in the HP 33S,
and program A is used, then the RTN at the end will go to label B at the top of program memory. Next time ¥ is
pressed, program B will begin, not program A. This means that only the program at the top of program memory will work
like a function key when ¥ is pressed. To execute program A if it is not at the top of memory, press tA.
Practice example: the sinc function
Example 3: As a third example, write a program to calculate the Sinc function Sinc(x) = Sin(x)÷x.
At first sight this looks little different from the previous program, but there is one difficulty – the program
needs to deal with the case of x = 0 when division by zero gives an error. The program needs to test for
x=0 and to handle that case specially. This example will show how tests are used in programs.
Solution:
Again write the program so it will use a number x that has been typed before the program begins. A
program like this will probably be used like an additional function on the calculator, so it should work both in
RPN mode and in algebraic mode, in the same way as functions built into the HP 33S. To do this, the
program will use a data register. Data registers are described in detail in a separate practice aid. The
program will also use a flag, flags are also described in a separate practice aid.
As before, first set program mode by typing ¹£ and then go to the top of program memory by
typing ¹rËË. Try storing the new program at the end of program memory. To do that, press the
up arrow key to go from the top of program memory to the last program instruction. If program A was typed
as above, the last instruction will be the RTN at its end. Give the new program the label "C", using the last
letter of "Sinc" to name it. Type ¹ÓC. To type C, press ) after pressing Ó.
hp calculators
- 6 -
Figure 11
HP 33S Writing a Simple Program - Version 1.0

Advertisement

loading