Hi everyone, I wrote a program as below, and I want to disable gobal interrupt in timer ISR by ONLY GIE, but no effect, please help to solve my problem and please let me know where is my mistake.
Thank in advance!
#include <msp430.h>
#include "MSP430_MACROs.h"
/*
* main.c
*/
void TIM_TRIG_ADCs_CFG(){
TA0CCTL0 &= ~CCIE;
TACTL = TASSEL_2 + MC_1; // Set the timer A to SMCLCK, Continuous
TA0CCR0 = 50000-1;
TA0CCTL0 |= CCIE;
_BIS_SR(GIE);
// __enable_interrupt();
}
void delay_ms (int t)
{
int i;
for (i = 0; i<t; i++ )
_delay_cycles(16000);
}
int count=0;
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
if (CALBC1_16MHZ==0xFF) // If calibration constant erased
{
while(1); // do not load, trap CPU!!
}
// configure clock to 16 MHz
BCSCTL1 = CALBC1_16MHZ; // DCO = 16 MHz
DCOCTL = CALDCO_16MHZ;
P1DIR |= LED_ALL;
P1OUT &= ~LED_ALL;
TIM_TRIG_ADCs_CFG();
while(1){
return 0;
}
}
int timerCount=0,tc1=0;
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A00 (void)
{
if((!((++timerCount)%96))){
T(1,0);
if(++tc1==8)
__bic_SR_register(GIE);
}
}