
Rev. 1.00
56
��ne 1�� �01�
Rev. 1.00
57
��ne 1�� �01�
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
Time Base Interrupt
For a time base interrupt to occur the global interrupt enable bit EMI and the corresponding interrupt
enable bit TBE, must first be set. An actual Time Base interrupt will take place when the time
base request flag TBF is set, a situation that will occur when the Time Base overflows. When the
interrupt is enabled, the stack is not full and a time base overflow occurs a subroutine call to time
base vector will take place. When the interrupt is serviced, the time base interrupt flag. TBF will be
automatically reset and the EMI bit will be automatically cleared to disable other interrupts.
Interrupt Wake-up Function
Each of the interrupt functions has the capability of waking up the microcontroller when in the
Sleep Mode. A wake-up is generated when an interrupt request flag changes from low to high and is
independent of whether the interrupt is enabled or not. Therefore, even though the device is in the
Sleep Mode and its system oscillator is stopped, situations such as external edge transitions on the
external interrupt pins, a low power supply voltage or may cause their respective interrupt flag to be
set high and consequently generate an interrupt. Care must therefore be taken if spurious wake-up
situations are to be avoided. If an interrupt wake-up function is to be disabled then the corresponding
interrupt request flag should be set high before the device enters the Sleep Mode. The interrupt
enable bits have no effect on the interrupt wake-up function.
Programming Considerations
By disabling the relevant interrupt enable bits, a requested interrupt can be prevented from being
serviced, however, once an interrupt request flag is set, it will remain in this condition in the
interrupt register until the corresponding interrupt is serviced or until the request flag is cleared by
the application program.
It is recommended that programs do not use the “CALL” instruction within the interrupt service
subroutine. Interrupts often occur in an unpredictable manner or need to be serviced immediately.
If only one stack is left and the interrupt is not well controlled, the original control sequence will be
damaged once a CALL subroutine is executed in the interrupt subroutine.
All of these interrupts have the capability of waking up the microcontroller when it is in Sleep
Mode, the wake up being generated when the interrupt request flag changes from low to high. If it is
required to prevent a certain interrupt from waking up the microcontroller then its respective request
flag should be first set high before entering the Sleep Mode.
As only the Program Counter is pushed onto the stack, then if the contents of the accumulator, status
register or other registers are altered by the interrupt service program, which may corrupt the desired
control sequence, then the contents should be saved in advance.
To return from an interrupt subroutine, either a RET or RETI instruction may be executed. The RETI
instruction in addition to executing a return to the main program also automatically sets the EMI
bit high to allow further interrupts. The RET instruction however only executes a return to the main
program leaving the EMI bit in its present zero state and therefore disabling the execution of further
interrupts.