![](http://datasheet.mmic.net.cn/30000/M30245MC-XXXGP_datasheet_2358670/M30245MC-XXXGP_252.png)
M30245 Group
Usage Notes
Rev.2.00
Oct 16, 2006
page 250 of 264
REJ03B0005-0200
Usage Notes
Timer A
Timer mode
The value of the counter can be read, with arbitrary timing, by reading the Timer Ai register while a count is in progress.
Reading the Timer Ai register with the reload timing gets “FFFF16”.
After setting a value in the Timer Ai register, a proper value can be read with the counter stopped before it starts counting.
Event counter mode
The value of the counter can be read, with arbitrary timing, by reading the Timer Ai register while a count is in progress.
Reading the Timer Ai register with the reload timing gets “FFFF16” by underflow or “000016” by overflow.
After setting a value in the Timer Ai register, a proper value can be read with the counter stopped before it starts counting .
Reset the timer when counting has stopped in free run type.
If using “Free-Run type”, the timer register contents may be unknown when counting begins. Set the timer value
immediately after counting has started.
Example if the up/down count is not switched:
Enable the “Reload” function and write to the timer register before counting begins.
Rewrite the value to the timer register immediately after counting has started.
If counting up, rewrite “000016” to the timer register.
If counting down, rewrite “FFFF1” to the timer register. This will cause the same operation as “Free-Run type”.
Example if the up/down count is switched:
Use the “Reload type” operation until the first count pulse is input.
Switch to “Free-Run type”.
One-shot timer mode
Setting the count start flag to “0” while a count is in progress causes as the following:
The counter stops counting and a content of reload register is reloaded.
The TAiOUT pin outputs “L” level.
The interrupt request generated and the Timer Ai interrupt request bit goes to “1”.
The output from the one-shot timer synchronizes with the count source generated internally. Therefore, when an
external trigger has been selected, a delay of one cycle of count source (maximum) occurs between the trigger input to
the TAiIN pin and the one-shot timer output.
The Timer Ai interrupt request bit goes to “1” if the timer's operation mode is set using any of the following procedures:
Selecting one-shot timer mode after reset.
Changing operation mode from timer mode to one-shot timer mode.
Changing operation mode from event counter mode to one-shot timer mode.
Therefore, to use Timer Ai interrupt (interrupt request bit), set Timer Ai interrupt request bit to “0” after the above listed
changes have been made.
If a trigger occurs while a count is in progress, after the counter performs one down count following the reoccurrence of
a trigger, the reload register contents are reloaded, and the count continues.
To generate a trigger while a count is in progress, generate the second trigger after a period longer than one cycle of the
timer's count source after the previous trigger occurred.