English
Language : 

PD17012_15 Datasheet, PDF (134/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
12.3.5 Notes on using basic timer 1
When creating a program, such as a watch program, in which processing is always performed at fixed time intervals
using basic timer 1 after the supply voltage has been applied (power-on reset), the basic timer 1 interrupt servicing
must be completed in a fixed time.
Let’s take the following example:
Example
M1
MEM
BTIMER1 DAT
0.10H
0002H
; 1 ms counter
; Symbol definition of interrupt vector address of basic timer 1
BR
START
; Branches to START
ORG
BTIMER1
; Program address (0002H)
ADD
M1, #0100B ; Adds 0100B to M1
SKT1
CY
; Watch processing if carry occurs
BR
EI_RETI
; Returns if no carry occurs
; <1>
Watch processing
EI_RETI:
EI
RETI
START:
INITFLG NOT BTM1CK1, BTM1CK0, NOT BTM0CK1, NOT BTM0CK0
; Embedded macro
; Sets time of interrupt by basic timer 1 to 250 ms
; and set time of BTM0CY flag to 100 ms
SET1
IPBTM1
; Embedded macro
; Enables interrupt by basic timer 1
EI
; Enables all interrupts
LOOP:
Processing A
BR
LOOP
In this example, watch processing <1> is executed every 1 second while processing A is executed.
If the CE pin goes high as shown in Figure 12-13 (a), CE reset is effected in synchronization with the rising of the
BTM0CY flag setting pulse.
If issuance of an interrupt request by the basic timer 1 happens to overlap with the setting of the BTM0CY flag
at this time, CE reset takes precedence.
When CE reset is effected, the basic timer 1 interrupt request (IRQBTM1) flag is cleared. Consequently, the timer
processing is skipped once.
132
Data Sheet U10101EJ4V0DS