
Chapter 6
;--------------------------------------------------------------
; delay subroutine for Fosc = 4MHz
; Total delay=(1+1+200+200+200*100+200*100+200+200)*1us=20.4ms
;--------------------------------------------------------------
DELAY20:
MOV A, @200
; 1 cycle
MOV 0x14, A
; 1 cycle
DL20: MOV A, @100
; 200 cycles
MOV 0x15, A
; 200 cycles
DL21: DJZ 0x15
; 200*100 cycles
JMP DL21
; 200*100 cycles
DJZ 0x14
; 200 cycles
JMP DL20
; 200 cycles
RET
6.6 Interrupt Subroutine
As described in the section on
Interrupts
(Section 3.5 of Chapter 3), four
interrupt sources are available for your applications, namely the TCC Interrupt,
MTC Interrupt, Speech Timer 1 Interrupt, and the Speech Timer 2 Interrupt.
The TCC and MTC interrupts use a common interrupt vector and can be polled
by the interrupt flags, i.e., TCIF and MIF.
The following sections describes how to implement these interrupt functions.
6.6.1 TCC Timer Interrupt
The TCC Timer interrupt is a general-purpose interrupt available for your
applications. The interrupt source comes from the TCC timer counter overflow
(the counter is mapped to R1). The interrupt vector is located at program
address 0x0002. The interrupt subroutines handle all the contextual switch
operation, which can be interrupted by the Speech Timer Interrupt. The
subroutine checks R5 (INTC) for the interrupt flag to determine the type of
interrupt currently in use. The flag is cleared by program before leaving the
interrupt subroutine to avoid recursive interrupts from happening.
The following are guidelines on how to setup the TCC interrupt
:
1. Set a suitable pre-scale ratio in IOC5.
2. Set the initial counter value in R1 for the TCC counter.
3. Set the TCC enable bit (TCIE) and global interrupt enable bit (ENI).
EM60000 Series User’s Manual
Software Application
•
87
Содержание EM60000 series
Страница 8: ...Contents viii Contents EM60000 Series User s Manual ...
Страница 24: ...Chapter 2 16 Architecture EM60000 Series User s Manual ...
Страница 54: ...Chapter 4 46 Special Function Control EM60000Series User s Manual ...
Страница 80: ...Chapter 5 72 Instruction Set EM60000Series User s Manual ...