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.
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.