Other Parts Discussed in Thread: TM4C123GH6PZ
hello~
when I setting a 32/64-bit wide timer in the RTC mode,I found that it can't interrupt by setting the value of GPTMTnMATCHR to be the current counting value plus 1.
And it can interrupt when I setting the value of GPTMTnMATCHR to be the current counting value plus 2,but the frequency of the interrupt is 1Hz.
Did i set it wrong ?
PS. the code runs in the TM4C123GH6PZ.
here is the code:
//init the WTIMER1 and it interrupts every second
SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER1);
TimerConfigure(WTIMER1_BASE,TIMER_CFG_RTC);
TimerLoadSet64(WTIMER1_BASE,1000);
TimerMatchSet64(WTIMER1_BASE,TimerLoadGet64(WTIMER1_BASE)+1);
TimerIntEnable(WTIMER1_BASE,TIMER_RTC_MATCH);
TimerIntRegister(WTIMER1_BASE,TIMER_A,WTimer1AIntHandler);
TimerEnable(WTIMER1_BASE,TIMER_A);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC6_WT1CCP0);
GPIOPinTypeTimer(GPIO_PORTC_BASE, GPIO_PIN_6);
void WTimer1AIntHandler(void)
{
uint32_t flag=0;
flag=TimerIntStatus(WTIMER1_BASE,TIMER_RTC_MATCH);
LEDBTrigger();
if(flag&TIMER_RTC_MATCH)
{
TimerIntClear(WTIMER1_BASE,TIMER_RTC_MATCH);
TimerMatchSet64(WTIMER1_BASE,TimerMatchGet64(WTIMER1_BASE)+2);
}
}