Hello,
It is not clear how you have already configured the timer for your 1ms tick. However, there would appear to be a couple of alternatives, using either one or two channels of the TPM module, in output compare mode. In both cases, the TPM modulo setting should remain at its default, with a free-running counter.
The first alternative would be to use separate channels for each of the intervals. When an interrupt occurs following each output compare event, simply add the number of increments corresponding to the required interval to the current channel value.
The second possibility would require only a single TPM channel, again using output compare mode (normally interrupt only configuration), to generate an interrupt every 62.5 microseconds. Then within the ISR, increment a count value. One in every 16 interrupts would then correspond with the `1ms tick.
count++; // Every 62.5us
if (!(count & 0x0F))
tick = 1; // Every 1ms
Regards,
Mac
Message Edited by bigmac on
2008-09-10 01:34 PM