BS2824 Holtek Semiconductor Inc., BS2824 Datasheet - Page 64

no-image

BS2824

Manufacturer Part Number
BS2824
Description
Touch Key Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
BS2824/BS2854/BS2868
Touch Key MCU
Rev. 1.00
Interrupt Register
Interrupt Operation
Overall interrupt control, which means interrupt enabling and request flag setting, is controlled by
using two registers, INTC0 and INTC1. By controlling the appropriate enable bits in this registers
each individual interrupt can be enabled or disabled. Also when an interrupt occurs, the
corresponding request flag will be set by the microcontroller. The global enable flag if cleared to
zero will disable all interrupts.
A Timer/Event Counter overflow, a Time Base event or an active edge on the external interrupt pin
will all generate an interrupt request by setting their corresponding request flag, if their appropriate
interrupt enable bit is set. When this happens, the Program Counter, which stores the address of the
next instruction to be executed, will be transferred onto the stack. The Program Counter will then be
loaded with a new address which will be the value of the corresponding interrupt vector. The
microcontroller will then fetch its next instruction from this interrupt vector. The instruction at this
vector will usually be a JMP statement which will jump to another section of program which is
known as the interrupt service routine. Here is located the code to control the appropriate interrupt.
The interrupt service routine must be terminated with a RETI instruction, which retrieves the
original Program Counter address from the stack and allows the microcontroller to continue with
normal execution at the point where the interrupt occurred.
The various interrupt enable bits, together with their associated request flags, are shown in the
following diagram with their order of priority.
Once an interrupt subroutine is serviced, all the other interrupts will be blocked, as the EMI bit will
be cleared automatically. This will prevent any further interrupt nesting from occurring. However, if
other interrupt requests occur during this interval, although the interrupt will not be immediately
serviced, the request flag will still be recorded. If an interrupt requires immediate servicing while the
program is already in another interrupt service routine, the EMI bit should be set after entering the
routine, to allow interrupt nesting. If the stack is full, the interrupt request will not be acknowledged,
even if the related interrupt is enabled, until the Stack Pointer is decremented. If immediate service is
desired, the stack must be prevented from becoming full.
When an interrupt request is generated it takes 2 or 3 instruction cycle before the program jumps to
the interrupt vector. If the device is in the Sleep or Idle Mode and is woken up by an interrupt request
then it will take 3 cycles before the program jumps to the interrupt vector.
Program
Program
Main
Main
64
Interrupt Request or
Interrupt Flag Set by Instruction
Interrupt Flow
N
Wait for 2 ~ 3 Instruction Cycles
Automatically Disable Interrupt
(it will set EMI automatically)
Clear EMI & Request Flag
Enable Bit Set ?
ISR Entry
RETI
Y
January 27, 2010

Related parts for BS2824