Hi all,
I'm trying to capture time initiated by software, this is the method I'm using to test this feature but the result I'm getting is always 1 (for the time elapsed), no matter the time I sleep in between
DCO at 1Mhz
Timer uses external osc of 32khz
Here is the code (configuring the clock, timer, and capturing):
BCSCTL3 |= LFXT1S_0 + XCAP_0; // 32768-Hz crystal on LFXT1 + Oscillator capacitor selection
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
TACTL = TASSEL_1 + MC_1; // ACLK, up mode
TACCTL1 = CM_1 + SCS + CAP + CCIS_2; //set to rising edge
TACCTL1 = CM_1 + SCS + CAP + CCIS_3; //set a rising edge
start_time = TACCR1;
TACCTL1 = CM_1 + SCS + CAP + CCIS_2;
temp_time = g_RTC_secondsCounter;
__delay_cycles(5000);
TACCTL1 = CM_1 + SCS + CAP + CCIS_3;
end_time = TACCR1;
TACCTL1 = CM_1 + SCS + CAP + CCIS_2;
if(temp_time != g_RTC_secondsCounter)
{
end_time += (temp_time-g_RTC_secondsCounter)*32768;
}
total_time = end_time - start_time;
Thanks in advance,