Part Number: MSP430F5529
Other Parts Discussed in Thread: MSP430F5329
Tool/software: Code Composer Studio
Hello Sir/Mam,
I have two TI controllers one is MSP430f5529 and other is MSP430f5329.
I setup UART interrupt communication protocol for communicating each other(full duplex communication).
Now the 5529 code part also have a timer setup with interrupt
The problem is my timer is running in background and in the while part i send some data to other msp5329 for a certain condition.
when my program reaches to send part of uart its automatically goes to UART interrupt part. and after that return to send function
i dont know how to solve this strange problem because timer have different interrupt and uart has different.
Here is my code of MSP430F5529.
void main()
{
Timer();
uartInit();
__enable_interrupt();
while(1)
{
//certain condition
send_uart("abcdef");
}
}
void Timer()
{
TA0CCTL0 = CCIE; // CCR0 interrupt enabled
TA0CCR0 = 1850;
TA0CTL = TASSEL_2 + MC_1 + TACLR;
}
/////////////////////timer interrupt part////////////////////////////////////////////////////////
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER1_A0_VECTOR))) TIMER1_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
count++;
P2OUT |= 0x07;
P1OUT |= 0xF8;
AllCondition();
__bis_SR_register_on_exit(GIE);
}
void uartInit()
{
P4SEL |= (BIT4+BIT5);
P4DIR |= BIT6; //clock for send data
P4REN |= BIT6;
P4OUT &=~ BIT6;
UCA1CTL1|=UCSWRST;
UCA1CTL1|=UCSSEL_2;
UCA1BR0 =9;
UCA1BR1 =0;
UCA1CTL1 &=~UCSWRST;
UCA1IE |=UCRXIE;
// __bis_SR_register(GIE);
__no_operation();
}
void send_uart(char *addr)
{ P4OUT|=BIT6;
unsigned int i;
unsigned int size =strlen(addr);
for(i=0;i<size;i++)
{
while(!(UCA1IFG & UCTXIFG));
UCA1TXBUF = addr[i];
}
P4OUT&=~BIT6;
}
//////////////////////////////////UART INTERRUPT///////////////////////////////////////
#if defined(__TI_COMPILER_VERSION__)|| defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
#elif defined(__GNUC__)
void__attribute__((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
#else
#error compiler not supported!
#endif
{
switch(__even_in_range(UCA1IV,4))
{
case 0:break;
case 2:
//while(!(UCA1IFG & UCTXIFG));
*received = UCA1RXBUF;
*received++;
break;
case 4:break;
default:break;
}
}