English
Language : 

PD17012_15 Datasheet, PDF (144/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
12.4.4 Application example of 12-bit timer
Example 1. Modulo count mode
TMINT
ORG
START:
LOOP:
DAT
0003H
BR
START
TMINT
Processing A
EI
RETI
; Symbol definition of 12-bit timer interrupt vector address
; Program address (0003H)
INITFLG TMCK
; Sets count clock to 100 kHz (10 µs)
MOV DBF2, #50 SHR 8 AND 0FH
MOV DBF1, #50 SHR 4 AND 0FH
MOV DBF0, #50 AND 0FH
PUT
TMM, DBF
SET1 IPTM
EI
SET3 TMRPT, TMRES, TMEN
Main processing
BR
LOOP
This program executes processing A every 500 µs.
However, processing A must be completed within 500 µs.
Example 2. Free-run count mode
BR
Start
Start:
INITFLG TMCK
; Sets count clock to 100 kHz (10 µs)
INITFLG NOT TMRPT, TMRES, TMEN
Processing A
SKF1
TMOVF
BR
Overflow occurs
GET
DBF, TMC
Overflow occurs
This program is to measure the time required for processing A. The measurable time range is from 10 µs to 40,950
µs (the software in Example 2 cannot measure time exceeding 40,950 µs and therefore, execution must branch to
another routine to measure the time longer than 40,950 µs).
This program is used to measure the pulse width of a remote controller signal.
The modulo count mode is useful for issuing an interrupt request at fixed time intervals, but the free-run count mode
is better to measure total time.
142
Data Sheet U10101EJ4V0DS