Remote-processing BASIC 52 Manuel d'utilisateur Page 10

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 163
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 9
RPBASIC-52 PROGRAMMING GUIDE
1-7
HARDWARE AND SOFTWARE
INTERRUPTS
RPBASIC52 generates two kinds of interrupts:
hardware and software. Hardware types are those
generated by a voltage change and go directly to the
processor. Software types require program execution
and set memory flags that are read by some other
program.
NOTE: Not all products support all or the same
interrupts. Make sure the "Cards:" category
in each command lists your card or re fer to
your hardware manual.
There are six interrupts in RPBASIC-52, version 1.11
and later. In the unlikely scenario that all interrupt
conditions are met at exactly the same time, they
would be serviced in the following order:
ONTICK Periodic
ONITR External line
ON COUNT Counter
ON LINE Line change
ON COM$ Serial input
ON KEYPAD Keypad
Interrupt priority is based on hardware or software
type. ONTICK and ONITR are considered hardware
types. Should either one of these interrupts become
active, ON COUNT, ON LINE , ON KEYPAD, and
ON COM$ interrupts are not run until either one is
finished. If an ONTICK interrupt is running, an
ONIT R interrupt is not serviced until O NTICK is
complete. ONTICK and ONIT R have the highest
priority.
ON COUN T, ON LINE, and ON COM $ interrupts
are serviced after ONT ICK and ONIT R are complete.
Should any these last three interrupts occur
simultaneously, ON COUN T would be executed first.
However, if any of these three interrupts occur after
one has started, then it would take priority.
Interrupts occur any time during program execu tion.
The RP BASIC operating system sets app ropriate
flags indicating which kind of interrupt needs
services. At the end of the current statement it checks
these flags. The time interval between the actual
interrupt and start of the interrupt routine is called
latency.
Latency varies a great deal, depending upon the type
of interrupt and command currently executed. A
"typical" time in RPBASIC is less than 1 ms.
However, it can be as short as several micro-seconds
to several seconds. The reason it can take so long is
due to the Basic subroutine. Suppose an ONTICK
interrupt is in progress and it is written so it takes
several seconds to complete. Since it is the highest
priority, all other interrupts are locked out. The best
way to correct this situation is to make all interrupt
routines as short as possible. This is handled by
setting a flag using a variable in the interrupt routine
then exiting. Then at some other non-critical time,
the interrupt is serviced.
WARNING: RPBASIC-52 offers a op portunity
for all interrupts to occur
simultaneously. It can handle all 21
interrupts simultaneously.
However, it cannot handle them
when they occur at a rate faster than
they are serviced. Servicing all 21
interrupts requires a minimum of 21
ms. If interrupts consistently come
in faster than they can be handled,
the program will stop and a control
stack error returned.
Whenever an ON COUNT or ON LINE multitasking
command is enabled, overall program speed slows
down. If all ON COUNT and ON LINE interrupts
were enabled (but lines were not changing), program
speed slows down by about 6%.
Vue de la page 9
1 2 ... 5 6 7 8 9 10 11 12 13 14 15 ... 162 163

Commentaires sur ces manuels

Pas de commentaire