|
发表于 2016-11-25 19:49:55
|
显示全部楼层
void setup_clocks_xt2 (void) {
int i;
BCSCTL1 = DIVA_0 ;
do {
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 50; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG));
BCSCTL2 = SELM_2 + DIVM_0 + SELS + DIVS_3;
}
Void setup_ta(void) {
TACCR0=13824; //11059200Hz /8/13824=100Hz for 10ms time base .
TAR=0;
TACTL = TASSEL_2 + MC_1 + TAIE ; // SMCLK, up counter mode, interrupt
TACCTL0 = CM_0 + CCIS_2 ; // Compare mode, SMCLK
TACCTL1 = CM_0 + CCIS_2 ; //
TACCTL2 = CM_0 + CCIS_2 ;
}
// ===========================================
// System timers
// ===========================================
// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A0 (void) {
// write you are program in here
}
// Timer_A1 Interrupt Vector (TAIV) handler
// TIMERA_ISR(Timer_A)
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A1(void) {
} |
|