
8-bit Timers
10-24
10.6.2
Event Counting
When using an 8-bit timer for event counting, make the settings according to the procedure described below.
When using the timers as a 16-, 24- or 32-bit timer by means of a cascaded connection, refer to section
10.6.3, "Cascaded Connection."
■
Procedure for initiating operation
(1) Set the timer division ratio.
Set the division ratio in TMnBR.
An interrupt request is then generated when the rising edge on the pin input is counted (value set in TMnBR +
1) times.
(2) Select the clock source.
Through TMnCK[2:0] in the TMnMD register, set the clock source to the TMnIO pin input.
(3) Initialize the timer.
Set TMnLDE to "1" in the TMnMD register to initialize timer n. The value set in TMnBR is loaded into
TMnBC as the initial value.
After initialization, be certain to set TMnLDE to "0" to return to normal operation mode.
(4) Set the I/O port.
Set the I/O port to the general-purpose input pin.
For details on the I/O port register settings, refer to chapter 15, "I/O Ports."
(5) Enable the timer counting operation.
Once TMnCNE is set to "1" in the TMnMD register, the counting operation is enabled.
Once the counting operation is enabled, the rising edge on the pin input is counted, and an interrupt request is
generated when there is an underflow in the binary counter. (Refer to Fig. 10-6-4.)
If the value in the TMnBR register is changed while the counting operation is in progress, that value is loaded as the
initial value the next time that an underflow is generated.
■
Procedure for ending operation
(1) Stop the timer counting operation.
Set TMnCNE to "0" in the TMnMD register, stopping the counting operation.
(2) Initialize the timer, if necessary.
If TMnLDE is set to "1" in the TMnMD register, the value that is set in TMnBR is loaded into TMnBC as the
initial value.
If only the timer is stopped and "1" is not written to TMnLDE, the status of the binary counter is maintained as
it was before the counting operation was stopped. If TMnCNE is set to "1", the count resumes from the state
that was in effect immediately before the counting operation was stopped.
Содержание MN103001G/F01K
Страница 1: ...MICROCOMPUTER MN1030 MN103001G F01K LSI User s Manual Pub No 23101 050E ...
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 7: ...14 A D Converter 15 I O Ports 16 Internal Flash Memory 17 Ordering Mask ROM Appendix 14 15 16 17 ...
Страница 8: ......
Страница 9: ...Table of Contents List of Figures and Tables 0 ...
Страница 26: ...xviii ...
Страница 27: ...1 0 1 General Specifications ...
Страница 35: ...2 CPU 2 ...
Страница 57: ...3 Extension Instruction Specifications 3 ...
Страница 96: ...Extension Instruction Specifications 3 40 ...
Страница 97: ...4 Memory Modes 3 4 ...
Страница 102: ...Memory Modes 4 6 ...
Страница 103: ...5 Operating Mode 5 ...
Страница 107: ...6 Clock Generator 6 13 ...
Страница 111: ...7 Internal Memory 7 ...
Страница 114: ...Internal Memory 7 4 ...
Страница 115: ...8 Bus Controller BC 8 ...
Страница 189: ...9 Interrupt Controller 9 ...
Страница 220: ...Interrupt Controller 9 32 ...
Страница 221: ...10 8 bit Timers 9 10 ...
Страница 254: ...8 bit Timers 10 34 ...
Страница 255: ...11 16 bit Timers 11 ...
Страница 292: ...16 bit Timers 11 38 ...
Страница 293: ...12 Watchdog Timer 11 12 ...
Страница 302: ...Watchdog Timer 12 10 ...
Страница 303: ...13 Serial Interface 13 ...
Страница 354: ...Serial Interface 13 52 ...
Страница 355: ...14 A D Converter 14 ...
Страница 367: ...15 I O Ports 15 ...
Страница 431: ...16 Internal Flash Memory 16 ...
Страница 439: ...17 17 Ordering Mask ROM ...
Страница 442: ...Ordering Mask ROM 17 4 ...
Страница 443: ...Appendix ...