![CMOSTEK NextGenRF CMT2189B Скачать руководство пользователя страница 78](http://html1.mh-extra.com/html/cmostek/nextgenrf-cmt2189b/nextgenrf-cmt2189b_user-manual_2627491078.webp)
AN201
Rev 1.5 | 78/91
www.cmostek.com
14 Interrupt Mode
The CMT2189B supports the following interrupt sources:
External interrupt from the PA2/INT pin
Timer 0 overflow interrupt
PORTA change Interrupt
Timer 2 compare matching interrupt
EEPROM data write Interrupt
Slow clock measurement Interrupt
The interrupt control register (INTCON) and peripheral interrupt request register (PIR1) record the interrupt flag bit. The INTCON
also contains the global interrupt enabling (GIE) bit.
When an interrupt is served, the following actions are performed automatically.
GIE is cleared to close the interrupt.
The return address is pushed onto the stack.
The program pointer is loaded with the 0004h address.
The return from Interrupt instruction (RETFIE) exits the interrupt routine, as well as sets the GIE bit, which re-enable the
unblocked interrupts.
The INTCON register contains the following interrupt flag bits.
INT pin interrupt
PORTA change interrupt
Timer 0 overflow interrupt
PIR1 contains the peripheral interrupt flag bit and PIE1 contains its corresponding interrupt enabling bit.
14.1 INT Interrupt
The external interrupt of the INT pin is triggered by edges. When the INTEDG bit of the OPTION register is set to 1, it is triggered
on the rising edge. It is triggered on the falling edge when the INTEDG bit is cleared,. 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 re-enabled, the INTF bit must be cleared by the software in the interrupt service routine. If the
INTE bit is set to 1 before entering the sleep state, the INT interrupt can wake up the MCU from the sleep state.
Notes:
1.
When using the INT interrupt, users should initialize the ANSEL and CM2CON0 registers so that the analog channel is
configured as a digital input. The pin configured as an analog input is always read as 0.