Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21927

MSP430F1611: Timer_B Counter Issue.

$
0
0

Part Number:MSP430F1611

Dear All,

I am currently trying to build a counter that increments every 7.25ms.

My device is TelosB, which is MSP430F1611 with Crystal Oscilator of 32768Hz.

I set the Timer_B with ACLK which is the crystal and as time = number of counts/frequency.

To increment every 7.25ms, 328 counts are required.  Please refer to the code attached.

I have an issue, because two of capture/compare reigsters are occupied for radio capture and interval.

Here I declared

void sctimer_asncounter(void){
TBCCTL3 = CCIE;
TBCCR3 = 328;
TBCCTL3 |= CCIFG;
}


which triggers the appropriate interrupt handler.

case 0x0006: // CCR3 fires
if (TBCCTL3 & CCI){
if(sctimer_vars.asnreadcb !=NULL){
sctimer_vars.asnreadcb();
// kick the OS
return KICK_SCHEDULER;
}
}


where 

void cb_asnread(void){
app_vars.num_asn++;
uart_writeByte(app_vars.num_asn);

sctimer_asncounter();
sctimer_setCompare(sctimer_readCounter()+SCTIMER_PERIOD);

}


So it should constantly increases app_vars.numb_asn++ every 7.25ms but for somereason I can't even compile the code.

any help will be greatly appreicated.

Thank you.

(Please visit the site to view this file)(Please visit the site to view this file)

(Please visit the site to view this file)


Viewing all articles
Browse latest Browse all 21927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>