Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

Why can't I obtain the interval when the value to compare register is set

Latest Updated:04/01/2006

Question:

I set a value to a compare register using the 16-bit timer, but I cannot obtain the desired interval.

Answer:

Once you have set a value to the compare register, save the sum of that value and the count value of the interval to the memory.
When a match interrupt occurs, write the value saved to the memory to the compare register, add the count value of the interval, and save the new value to the memory again.
A signal with a fixed interval can be obtained by repeating this processing.
Be sure, however, to observe the conditions described in the user's manual or other document when writing a value to the compare register.

[Reference]
This 16-bit timer is a free-running counter.
Therefore, once a value is set to a compare register, that value is compared with the timer value and a match signal is generated if they match.
The timer continues operating.
After this, the next match will occur after the timer has completed a cycle, so the interval will occur at each 16-bit count.
To avoid this, the value set to the compare register must be updated dynamically as described above.

Suitable Products
UPD7890xx/7891xx
UPD7893xx/7894xx
UPD7898xx