AnsweredAssumed Answered

Counter in KL26Z128

Question asked by Rafael Dalazen on Feb 11, 2016
Latest reply on Feb 15, 2016 by Robin_Shen

Hi!

I'm trying to read the RTC Time Preacaler Register, but it only returns zeros. I'm setting SR[TOF] and SR[TIF] to zero to avoid this problem, but this have not been effective.

 

Below, my code:

 

void RTC_init (void){

 

  SIM_SCGC6 |= (SIM_SCGC6_RTC_MASK);

 

  RTC_SR |= (RTC_SR_TCE_MASK|~RTC_SR_TIF_MASK|~RTC_SR_TOF_MASK);

}

 

 

int RTC_counter(void){

 

  return RTC_TPR;

}

 

Anyone knows where is the error?

 

Thanks in advance,

Rafael

Outcomes