Daniel Nataniel

Need help with Real Time Interrupt

Discussion created by Daniel Nataniel on Apr 15, 2011
Latest reply on Apr 16, 2011 by kef

I am trying to use an interrurpt using RTI module in CRG. The interrupt must keep track of minute and second

elapsed since the start up. The port t bit 7 must set up as an output and toggled every 0.5 ms.

This is how i calculated the prescaler needed :

period = 1/oscClk*prescaler

prescaler = 0.5/(1/16Mhz) 

prescaler = 8000000

 

However, the maximum value for the prescaler is 1048576.

Did i do anything wrong with the calculation?

Do i have to use modulus counter?

 

The modulus counter will be used to generate periodic interrupt every 2 seconds, so i don't think i can use the modulus

counter there.

 

the function looks like this

 

void CRG_SetupRTI(const UINT8 prescaleRate, const UINT8 modulusCount)

Outcomes