80 CHAPTER 7. INTERRUPT PROCESSING
2. Write the service routine. As part of the service make sure you turn off the
flag that generated the interrupt.
3. Let HC11 know where to find the service. In other words, Link the service
to the request.
With this background, we will modify the square wave generator to use the
interrupt. Here is the complete code with some of the standard equates left out
(you need to have them at the top of the file!). You should compare this code with
the earlier one. In this code, the main program does nothing really interesting. It
just prints a series of Z’s to the screen
; Various defines go here ...
ORG $3000 don’t forget the $
ME FCC /Your name/
FCB 10
FCC /ECE 372/
FCB 10
FCC /Date the program was last changed/
FCB 10, 10, 4
ORG $2000 DONT FORGET THE $
LDX #ME
JSR OUTSTRG ; MAKE SURE YOU HAVE EQU FOR OUTSTRG
LOOP1
; Enable TOF interrupt by setting TOI (bit#7 in TMSK2)
SEI
LDAA #%10000000
STAA TMSK2
CLI
; Now go about your business of printing Z’s
LDAA #’Z’
LOOP JSR OUTA
BRA LOOP
; End of main program
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Comentarios a estos manuales