LCD Type MCU
Example: Using Timer/Event Counter 0 as the clock source for Timer/Event Counter 1 to configure
a 24-bit counter
START:
mov a,09h
mov
mov
mov
mov
mov
mov
mov
intc0,a
a,01h
intc1,a
a,80h
tmr1c,a
a,0a0h
tmr0c,a
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Set ET0I & EMI bits to enable Timer 0 and global
interrupt
Set the ET1I bit to enable the Timer 1 interrupt
Configure Timer 1 to operate
Timer 1 clock source depends
Configure Timer 0 to operate
and select system clock/4 as
in timer mode
on configuration option
in timer mode
Timer 0 clock source
set tmr1c.4
clr tmr1c.4
mov a,00h
mov
mov
mov
mov
tmr0,a
a,00h
tmr1l,a
tmr1h,a
Enable then disable Timer 1
Necessary step for cascaded timers
Load a desired value into both the TMR0 and TMR1
registers
set tmr0c.4
set tmr1c.4
END
; Turn Timer 0 on
; Turn Timer 1 on
Interrupts
The LCD type of microcontrollers each contains a range of both external and internal interrupt func-
tions. The external interrupt is controlled by the action of the external pins INT0 and INT1 which
are present on all devices. The internal interrupts are controlled by various sources of which in-
clude the Timer/Event Counters, the Time Base and the Real Time Clock. Additionally, in the
HT49RU80/HT49CU80 devices there is a UART interrupt and a Multi-function interrupt.
Interrupt Registers
For the LCD type of microcontroller devices, three interrupt control registers, known as INTC0,
INTC1 and MFIC, are provided to control all the interrupt control features. Note that only the
HT49RU80/HT49CU80 devices contain the MFIC register.
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 ser-
viced, 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 ser-
vice is desired, the stack must be prevented from becoming full.
68
Home Index Bookmark Pages Text
Previous Next
Pages: Home Index