Specifications

Programing Tips - 3
second software interrupt occurs while the system is in a subroutine for another interrupt, nesting occurs. This
means that the second interrupt will interrupt the first subroutine. After the second subroutine finishes
executing, the first subroutine can finish executing. Use LOCK and UNLOCK if this will cause a problem in
your program.
Nesting can occur at any level, limited only by the amount of memory. Keep in mind that the last interrupt
ultimately has the highest priority, while 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 COM$ 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 while 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 errors 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.22999 to 1.23001 and the equality would not be met.
10 IF A=1.23 THEN 100
A better method is
10 IF A=>1.23 THEN 100