Editing is an essential part of programing. In tact it is nearly
impossible to write the perfect program first time. Any non
trivial program will have to be edited. Perhaps many times. You
will find that you spend just as much time editing a program as
writing it. Editing is an essential skill.
The aim here is to get you started; point you in the right
TYPES OF ERRORS.
(1) syntax errors. These occur when you do not follow the
rules of the language. eg. every Do loop must start with
a Do command, must have a UNTIL test near the end and a END
command at the end.
If any of these commands are missing the following message
will appear."Invalid syntax". The calculator will highlight
where it thinks the problem is. This may or may not be the
problem. It is only through experience that you get to know
how to solve the problem. Usually syntax problems are
easy to solve.
The calculator displays "invalid Syntax" when you try to
enter the new program onto the stack. At this stage the
calculator is in edit mode. Press the arrow buttons to get to
where you want to go. ie. K for up, P for left, R for right
and Q for down.
Then place the missing command or commands. Press right
shift then the down button. This will take you to the end of
the program. Then press ENTER. If there are no other syntax
errors the program will go onto the stack.
If you type in the command do not forget to leave space
between adjoining commands. It does not matter if there are
more than one space in between commands. When the program is
compiled these extra spaces are eliminated.
(2) Run type errors. When a program does not do what you
want it to do, then it has a run type error. This is the most
common type of error.
After you have written the program and stored it under a
name, you will need to test run it using various data.
When you run the program the display may not be how you want
it; or the results may not be correct.
In order to edit a stored program, do the following.
(1) Put the program name on the stack.
(2) Press left shift key then EDIT. Now you can add to or
delete any part of the program.
(3) Once complete Press right shift arrow down. This will
bring you to the bottom of the program. Then press ENTER.
This last step stores your modified program. If you simply
just press the cancel key your changes will be lost.
Editing is covered in the manual on pages 29-8 & 29-9.
SINGLE STEP EXECUTION.
When you are debugging a program it is sometimes desirable to see
how each step works. By doing this you can in a lot of cases
detect where a problem lies.
The procedure is simple. First of all place a HALT command in the
program just before the section you want to check. Now run the
program. When the program gets to the halt then use the SST
command. To get the SST command first hit PRG key, then NXT key,
press RUN key in the menu, then finally SST in the menu. SST will
show what the next step is in the program and also how that step
SST treats a sub program as a single step. Therefore in order to
view the single steps in the subprogram use SST arrow down, see
page 29-9 in the manual.
THE NEXT TOPIC FOR A TUTORIAL WILL BE THE USE OF VECTORS.
Vectors have been around for over 100 years. A lot of Survey
problems can be handled by using them. There are built in vector
commands on the HP 48 that make the use of vectors easy.