English
Language : 

PD17012_15 Datasheet, PDF (131/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
12.3.3 Application example of basic timer 1
A program example is shown below.
Example
M1
MEM
BTIMER1 DAT
0.10H
0002H
; 80 ms counter
; Symbol definition of basic timer 1 interrupt vector address
ORG
EI_RETI:
START:
LOOP:
BR
START
BTIMER1
ADD
M1, #0001B
SKT1
CY
BR
EI_RETI
Processing A
; Branches to START
; Program address (0002H)
; Adds 1 to M1
; Tests CY flag
; Returns if no carry
EI
RETI
INITFLG
MOV
SET1
EI
BTM1CK1, NOT BTM1CK0
; Embedded macro
; Sets basic timer 1 interrupt pulse to 5 ms
M1, #0000B ; Clears contents of M1 to 0
IPBTM1
; Enables basic timer 1 interrupt
; Enables all interrupts
Processing B
BR
LOOP
This program executes processing A every 80 ms.
The points to be noted in this case are that the DI status is automatically set when an interrupt has been
acknowledged, and that the IRQBTM1 flag is set to 1 even in the DI status.
This means that the interrupt is acknowledged even if execution exits from an interrupt routine by execution of the
RETI instruction, if processing A takes longer than 5 ms.
Consequently, processing B is not executed.
Data Sheet U10101EJ4V0DS
129