5 one-shot operation – Panasonic MN103001G/F01K User Manual

Page 280

Advertising
background image

16-bit Timers

11-26

11.6.5

One-shot Operation

It is possible to stop timer 10 when TM10BC and TM10CA match. Figs. 11-6-9 and 11-6-10 illustrate the operation

that stops timer 10.
The compare/capture B register can be used as a compare register or as a capture register.

Procedure for initiating operation

(1) Set the compare/capture A register mode.

Set the TM10MDA register as follows:

TM10AO2,1,0

Don't care

TM10ACE

0: Capture operation disabled

TM10AEG

Don't care

TM10AM1,0

00: Compare register (single-buffer)
or

01: Compare register (double-buffer)
If the value in the compare/capture A register will change while the counting operation is

in progress, be certain to set "double-buffer."

(2) Set the value at which the timer is to stop.

Set the comparison value in TM10CA.
The timer will stop when it reaches the count of (value set in the TM10CA register + 1).

(3) Set the operating mode.

Set the TM10MD register as described below:

TM10CK2,1,0

Don't care; Select any clock source.

TM10CAE

1:

Clears TM10BC when TM10CA matches TM10BC.

TM10ONE

1:

Enables one-shot operation.

TM10TGE

0:

Disables timer start by an external trigger.

TM10PM1,0

Don't care; This setting is ignored.

TM10PME

0:

Selects the normal waveform.

TM10LDE

0:

Normal operation.

TM10CNE

0:

Stops counting operation.

When using 1/8 IOCLK or 1/32 IOCLK as the clock source, set TMPSCNE in the TMPSCNT register to "1" to
enable prescaler operation before enabling the counting operation for timer 10.

(4) Initialize the timer.

Set TM10LDE in the TM10MD register to "1" in order to initialize timer 10.

TM10BC is cleared, and the pin output is reset.

In addition, if TM10CA is set as a double-buffer compare register, the value in the buffer is loaded into the
compare register.

After initialization is completed, be certain to reset TM10LDE back to "0" in order to restore normal operation
mode.

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

Set the I/O port to "timer output pin."

In the I/O port register, select "timer output" for the output signal and then set the output pin.

When the timer is to be started up by an external trigger, set the TM10IOB pin to "input pin".

(6) Enable the timer counting operation.

The counting operation starts when the TM10CNE in the TM10MD register is set to "1".

If the timer is to be started by an external trigger, leave TM10CNE set to "0" and set TM10TGE to "1".

When starting to count up again after TM10BC and TM10CA have matched, the hardware clears the TM10CNE
flag to stop the counting operation. TM10BC is also cleared.

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

Advertising