Panasonic F77G User Manual page 273

Microcomputer mn101c series
Table of Contents

Advertisement

7-3-2
Setup Example
Timer Operation Setup Example (Timer 7)
Timer 7 generates an interrupt constantly for timer function. Fosc/2 (fosc=20 MHz) is selected as a clock
source to generate an interrupt every 1000 cycles (100 µs).
An example setup procedure, with a description of each step is shown below.
Setup Procedure
(1) Stop the counter.
TM7MD1 (x'3F78')
bp4
(2) Select the timer clear source.
TM7MD2 (x'3F79')
bp5
(3) Select the count clock source.
TM7MD1 (x'3F78')
bp1-0
bp3-2
(4) Set the interrupt generation cycle.
TM7PR1 (x'3F75', x'3F74')=x'03E7
(5) Set the interrupt level.
TM7ICR (x'3FF1')
bp7-6
(6) Enable the interrupt.
TM7ICR (x'3FF1')
bp1
: TM7EN
= 0
: TM7BCR = 1
: TM7CK1-0 = 00
: TM7PS1-0 = 01
: TM7LV1-0 = 10
: TM7IE
= 1
Description
(1) Set the TM7EN flag of the timer 7 mode
register 1 (TM7MD1) to "0" to stop timer 7
counting.
(2) Set the TM7BCR flag of the timer 7 mode
register 2 (TM7MD2) to "1" to select the
compare match as a binary counter clear
source.
(3) Select fosc as a clock source by the TM7CK1-
0 flag of the TM7MD1 register. Also select 1/2
fosc as a count clock source by TM7PS1-0
flag.
(4) Set the interrupt generation cycle to the timer 7
preset register 1 (TM7PR1). The cycle is 1000.
The set value should be 1000-1=999(x'03E7').
At that time, the same value is loaded to the
timer 7 compare register 1 (TM7OC1), and the
timer 7 binary counter (TM7BC) is initialized to
x'0000'.
(5) Set the interrupt level by the TM7LV1-0 flag of
the timer 7 interrupt control register (TM7ICR).
If the interrupt request flag may be already set,
clear the request flag.
[
Chapter 3 3-1-4. Interrupt Flag Setup ]
(6) Set the TM7IE flag of the TM7ICR register to
"1" to enable the interrupt.
Chapter 7 16-bit Timer
VII - 13
16-bit Timer Count

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Panaxseries mn101c77cPanaxseries mn101f77g

Table of Contents