Rev. 1.00
92
March 24, 2020
Rev. 1.00
93
March 24, 2020
BS83A04C
4-Key Enhanced Touch I/O Flash MCU
BS83A04C
4-Key Enhanced Touch I/O Flash MCU
External Interrupt
The external interrupt is controlled by signal transitions on the INT pin. An external interrupt
request will take place when the external interrupt request flag, INTF, is set, which will occur
when a transition, whose type is chosen by the edge select bits, appears on the external interrupt
pin. To allow the program to branch to its respective interrupt vector address, the global interrupt
enable bit, EMI, and respective external interrupt enable bit, INTE, must first be set. Additionally,
the correct interrupt edge type must be selected using the INTEG register to enable the external
interrupt function and to choose the trigger edge type. As the external interrupt pin is pin-shared
with I/O pin, it can only be configured as external interrupt pin if its external interrupt enable bit
in the corresponding interrupt register has been set and the external interrupt pin is selected by the
corresponding pin-shared function selection bits. The pin must also be setup as an input by setting
the corresponding bit in the port control register. When the interrupt is enabled, the stack is not full
and the correct transition type appears on the external interrupt pin, a subroutine call to the external
interrupt vector, will take place. When the interrupt is serviced, the external interrupt request flag,
INTF, will be automatically reset and the EMI bit will be automatically cleared to disable other
interrupts. Note that any pull-high resistor selections on the external interrupt pins will remain valid
even if the pin is used as an external interrupt input.
The INTEG register is used to select the type of active edge that will trigger the external interrupt.
A choice of either rising or falling or both edge types can be chosen to trigger an external interrupt.
Note that the INTEG register can also be used to disable the external interrupt function.
I
2
C Interrupt
An I
2
C interrupt request will take place when the I
2
C Interrupt request flag, I2CF, is set, which
occurs when a byte of data has been received or transmitted by the I
2
C interface, or an I
2
C slave
address match occurs, or an I
2
C bus time-out occurs. To allow the program to branch to its respective
interrupt vector address, the global interrupt enable bit, EMI, and the Serial Interface Interrupt
enable bit, I2CE, must first be set. When the interrupt is enabled, the stack is not full and any of
the above described situations occurs, a subroutine call to the respective Interrupt vector, will take
place. When the interrupt is serviced, the Serial Interface Interrupt flag, I2CF, will be automatically
cleared. The EMI bit will also be automatically cleared to disable other interrupts.
Time Base Interrupt
The function of the Time Base Interrupt is to provide regular time signal in the form of an internal
interrupt. It is controlled by the overflow signals from their respective timer functions. When it
happens, its respective interrupt request flag, TBF will be set. To allow the program to branch to
its respective interrupt vector addresses, the global interrupt enable bit, EMI and Time Base enable
bit, TBE, must first be set. When the interrupt is enabled, the stack is not full and the Time Base
overflows, a subroutine call to its respective vector location will take place. When the interrupt is
serviced, the respective interrupt request flag, TBF, will be automatically reset and the EMI bit will
be cleared to disable other interrupts.
The purpose of the Time Base Interrupt is to provide an interrupt signal at fixed time periods. Its
clock source, f
PSC
, originates from the internal clock source f
SYS
, f
SYS
/4 or f
SUB
and then passes
through a divider, the division ratio of which is selected by programming the appropriate bits in the
TBC register to obtain longer interrupt periods whose value ranges. The clock source which in turn
controls the Time Base interrupt period is selected using the CLKSEL1~CLKSEL0 bits in the PSCR
register.