Remote Processing CAMBASIC User Manual

Page 26

Advertising
background image

Program ing Tips - 3

b.

Erroneous error m essage for a good line.

c.

A < System corruption> error message.

d.

The system will not respond to the keyboard.

e.

The program stops or locks up.

2.

Software interrupts occur as a result of ON COU NT, ON KEY PAD $, ON BIT and similar statements. If a
second softwar e interrupt occur s while the system is in a subrou tine for another inter rupt, nesting occurs.
This means that the second interrupt will interrupt the first subroutine. After the second subroutine finishes
executing, the first subr outine can finish executing. Use L OCK and UN LOC K if this will cause a problem in
y o ur p r og r a m .

Nesting can occur at any level, limited only by the amount of memor y. Keep in mind that the last interrupt
ultimately has the highest priority, w hile the first interrupt has the lowest priority.

There is one situation where nesting can cause serious problems. Suppose an ON COM$ statement were
issued, the conditions were met and you have entered a subroutine. If a second interrupt occurs from the
same ON C OM$ statement, it will interrupt itself.

The effect of this is that the second interrupt may change variables that the first interrupt has yet to use. You
can avoid this situation by either disabling the ON COM$ statement w hile you are in an interrupt routine or
preventing the sender from sending more data until you have processed the first data.

A good rule of the thumb is that all interrupt service routines should be as short as possible.

3.

Before downloading a program from the PC , always type NEW if a program already exists. This will speed
up the download.

4.

When doing a comparison on the result of multiple calculations, rounding error s can cause a comparison to be
missed. In the example below A is the result of multiple calculations, the variable A (below ) could increase
from 1.2 2999 to 1. 23001 and th e equality w ould not be m et.

10 IF A=1.23 THEN 100

A better method is

10 IF A=>1.23 THEN 100

Advertising