Pular para o conteúdo principal
Knowledgebase
Home
Renesas Brasil - Knowledgebase

What precautions concerning usage of interrupts for timer 1 and 2?

Latest Updated:03/01/2005

Question:

(Timer)   For timer 1 or timer 2, the prescaler and timer register are initialized each time an interrupt is generated. What are the precautions concerning usage of interrupts in this way? [2005/03/01]

Answer:

In this case, the period of the timer interrupt becomes "the value of the initialized timer + the processing time from after the interrupt request is generated until the prescaler and timer register are initialized".

<Note regarding initialization procedures>
We recommend setting the prescaler first, then the timer.
The timer and prescaler continue counting even while being set. Therefore, they may down-count from the transient value during initialization. When the timer is set before the prescaler is set, if the prescaler underflows within the period after the timer is set but before the prescaler is set, the timer will down-count from the latest value. Accordingly, the period until the next interrupt will be shortened.
<Note regarding interrupts generating time lags>
After an interrupt request is generated due to a timer underflow, the time until the interrupt routine is actually started varies according to the number of cycles of the instruction being executed at the time the request was generated.

(#104781)

Suitable Products
3803H
3803L
3850A
3858
7544
7546
7547
7548
7549