6 description of operation, 1 interval timers and timer output – Panasonic MN103001G/F01K User Manual

Page 240

Advertising
background image

8-bit Timers

10-20

10.6 Description of Operation

This section describes the operation of the 8-bit timers.

10.6.1

Interval Timers and Timer Output

When using an 8-bit timer as an interval timer, make the appropriate settings according to the procedure described

below.
The timer in question then operates as an interval timer that generates interrupts on the set cycle. (Refer to Figs.

10-6-1 to 10-6-3.)
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."
The procedure for generating the reference clock for the serial interfaces and for generating the A/D conversion

start trigger is the same.

Procedure for initiating operation

(1) Set the timer division ratio.

Set the division ratio in TMnBR.

The interrupt request cycle is then:
(value set in TMnBR + 1) x Clock source cycle

(2) Select the clock source.

Select the clock source through TMnCK[2:0] in the TMnMD register. When using either 1/8 IOCLK or 1/32

IOCLK as the clock source, set TMPSCNE to "1" in the TMPSCNT register to enable prescaler operation.

(3) Output mode setting (Applies to timers 4 to B only.)

Set TMnOM[1:0] in the TMnMD register to underflow 1/2 cycle output, and select the polarity after initialization.

(4) 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, and the timer output is reset.

After initialization, be certain to set TMnLDE to "0" to return to normal operation mode.

(5) Set the I/O port. (Applies when using timer output.)

Select the output signal in the TMOSL register.
Set the I/O port to the timer output pin.

Select the timer output for the output signal in the I/O port register, and then set it to the output pin.

Note : For details on the I/O port register settings, refer to chapter 15, "I/O Ports."

Advertising