Tool/software: TI C/C++ Compiler
hello,
im using msp430f5529, Im facing a strange problem where i use UART to send data to ESP8266 wifi module and also receive the same.
my question is while transmitting and receiving data through uart it work properly. but when i used timer in between any function, my transmitting part get stopped when using timer.
my timer is approx 60 sec delay, i.e. my transmitting process holds for 60 sec when timer runs and after that when my timer get suspend the uart start sending data properly.
As we all know our msp430f is a multitasking controller, so why we are facing this problem?
please help me.
here im attatching some uart function and timer function.
//////////// timer function //////////////
void timer()
{
P4OUT|=BIT0;/// GREEN
P4OUT&=~BIT1;
TBCCTL0 = CCIE; // TBCCR0 interrupt enabled
TBCCR0 = 65534;
TBCTL = TBSSEL_1 + MC_3 + TBCLR; // SMCLK, upmode, clear TBR
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
}
//////////////////////// timer interrupt ////////////////////////
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERB0_VECTOR
__interrupt void TIMERB0_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERB0_VECTOR))) TIMERB0_ISR (void)
#else
#error Compiler not supported!
#endif
{
if(count_1==5)
{
TBCTL &=~ MC_3;
P4OUT&=~BIT0; /// GREEN
count_1=0;
__bic_SR_register_on_exit(LPM0_bits + GIE);
}
count_1++;
}
////////////////////////////////////// UART SEND ////////////////////////////////////////
void send_uart(char *addr)
{
unsigned int i;
__disable_interrupt();
unsigned int size =strlen(addr);
for(i=0;i<size;i++)
{
while(!(UCA0IFG & UCTXIFG));
UCA0TXBUF = addr[i];
}
__enable_interrupt();
}
//////////////////////////////////UART INTERRUPT///////////////////////////////////////
#if defined(__TI_COMPILER_VERSION__)|| defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void__attribute__((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break;
case 2:
//while(!(UCA0IFG&UCTXIFG));
*tx= UCA0RXBUF;
tx++;
break;
case 4:break;
default:break;
}
}