AN202
V1.0 | Page 60/73
www.cmostek.com
14 Interrupt Mode
CMT2189C has the following interrupt sources:
External Interrupt from PA2/INT
Timer0 Overflow Interrupt
PORTA ChangeInterrupt
Timer2 MatchInterrupt
EEPROM Data Write Interrupt
Fail-Safe Clock Monitor Interrupt
Comparator Interrupt
The Interrupt Control Register (INTCON) and the Peripheral Interrupt Request Register (PIR1) record the
interrupt flag bit. INTCON also contains the Global Interrupt Enable bit (GIE).
When the interrupt is served, the following action occurs automatically:
GIE is cleared to close the interrupt.
The return address is pushed onto the stack.
The program pointer is loaded to the 0004h address.
The Return from Interrupt instruction (RETFIE) exits the interrupt routine, as well as sets the GIE bit, which
re-enable unmasked interrupt.
The INTCON register contains the following interrupt flag bit:
INT pin interrupt
PORTA change interrupt
Timer0 overflow interrupt
PIR1 includes the Peripheral Interrupt Flag bit. PIE1 includes its corresponding Interrupt Enable bit.
14.1
INT Interrupt
The external interruptof the INT pin is triggered by the edge. When the INTEDG bit of the OPTION register is
set to 1, it is triggered at the rising edge. And when the INTEDG bit is cleared, it is triggered at the falling
edge.When an effective edge occurs on the INT pin, the INTF bit of the INTCON register is set to 1.The
interrupt can be disabled by clearing the INTE control bit of the INTCON register. Before the interrupt is
reallowed, the INTF bit must be cleared by the software in the interrupt service program.If the INTE bit is set to
1 before entering the sleep status, the INT interrupt can wake up the MCU from the sleep status.
Note: When INT interrupt is used, the ANSEL and CM2CON0 registers must be initialized so that the analog
channel is configured as a digital input.The pin configured as an analog input is always read to 0.
Содержание CMT2189C
Страница 32: ...AN202 V1 0 Page 32 73 www cmostek com...