MSP430F5529 Infrared Module

MSP430F5529 Infrared Module
0.0 0

#1

Good day
This is the program:

[code]#include <msp430.h>

#define CPU_F ((double)1000000)
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
int cnt;
volatile int iflag=0;
void ir_open(){
iflag=0;
P2DIR |= BIT3;//P2.2, P2.3 output
P2SEL &= ~BIT3; //P2.2:IO P2.3:TA0
P2OUT &= ~BIT3;

//38K->P2.3
TBCCR0=15;

/TBCCR0 = (int)(26.38 + 0.5);`
TBCCTL0 = OUTMOD_6;
TBCCR1 = (int)(13.15*8 + 0.5);
*/
TBCTL = TASSEL_2+MC_1+TACLR;
TBCCTL0=CCIE;
}

void ir_start(){
P2OUT |= BIT3;
iflag=1;
delay_us(9000);
TBCTL =MC_1;

P2OUT &= ~BIT3;
iflag=0;
delay_us(4500);
TBCTL =MC_0;
}

void ir_next(){
P2OUT |= BIT3;
iflag=1;
delay_us(9000);

P2OUT &= ~BIT3;
iflag=0;
delay_us(2250);
}

void ir_send_byte(unsigned char c){
unsigned char i;

for(i = 0; i != 8; ++i){
P2OUT |= BIT3;
iflag=1;
delay_us(560);

P2OUT &= ~BIT3;
iflag=0;
if(c&0x01){
  delay_us(1685);
}
else{
  delay_us(565);
}

c >>= 1;

}
}

void ir_end(){
P2OUT |= BIT3;
iflag=1;
delay_us(300);
P2OUT &= ~BIT3;
iflag=0;
}

void ir_put(unsigned char c){
ir_start();
ir_send_byte(0x00);
ir_send_byte(0x90);
ir_send_byte(0x04);
ir_send_byte(0x0A);
ir_end();
}
int main(void)
{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT

P1DIR |=BIT0 ; // P1.0 output

while(1)
{

//yanshi 1s
/* cnt = 1000;
TA0CCTL0 = ~CCIE;

while(cnt!= 0);
P1OUT ^= BIT0;
TA1CTL = MC_0;  //mc_0=stop*/

      P1OUT ^= BIT0;
      ir_open();
      __bis_SR_register(GIE);
      ir_put(0x83);

}
}

//#pragma vector = TIMERB_A0_VECTOR
#pragma vector=TIMERB0_VECTOR
__interrupt void TIMERB0_ISR()
{
if(iflag==1);
P2OUT ^= BIT3;

}[/code]
The datasheet of MSP430F5529
I would like to ask that:
Are there any wrongs in my program? 38KHZ, my timer is every 13.8usIO level flip a time. However, it cannot operate after entering into interrupt.
Thank you for you kind help!