Motorola Axiom CMD11E1 Uživatelská příručka Strana 78

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 101
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 77
78 CHAPTER 7. INTERRUPT PROCESSING
; CLEAR THE FLAG. NO HARM IS DONE IF IT IS ALREADY CLEARED
LDAA #%10000000
STAA TFLAG2
;WAIT FOR THE FLAG TO BE SET
LOOP2
LDAA TFLAG2
ANDA #%10000000
BEQ LOOP2
;NOW TOGGLE PA4
LDAA #%00010000
EORA PORTA
STAA PORTA
;DO IT ALL OVER AGAIN
BRA LOOP1
7.3 Interrupts
If you study the above co de, most of the time is spent waiting for the clock to
rollover (the loop at LOOP2). This is a lot like sitting in front of the clock and
watching and waiting for the clock to rollover. Or, for that matter, sitting in
front of a stove and watching and waiting for kettle to boil, or watching food
being cooked in a microwave oven. A better solution would be to go about ones
job and arrange matters so that one is told when an event occurs (the clock chimes,
the kettle whistles, the microwave oven sounds an alarm etc.). When we are told
that the event has occurred, we then take appropriate action (turn off the stove,
take food out of the oven etc.). Most of the HC11 interrupts work the same way.
In essence this is what happens:
1. When an event occurs, a flag is set. For example, the clock rollover sets the
TOF flag.
2. Associated with the flag is a masking bit. The name of the bit is the same
as the flag except the final F is replaced by I. The mask associated with TOF
is TOI.
(a) If the mask is zero, then nothing much happens. The event is ignored
by the interrupt processing structure.
Zobrazit stránku 77
1 2 ... 73 74 75 76 77 78 79 80 81 82 83 ... 100 101

Komentáře k této Příručce

Žádné komentáře