Sir, I need one more help. I have connected msp430fr2422 kit with CP210x USB to UART converter. But i am not able to transmit and recive the data through the cp210 converte.
Below the attachment of hard code. please rectify the problem.
WDTCTL = WDTPW | WDTHOLD;
P2DIR = BIT3;
P2OUT &= ~BIT3;
PM5CTL0 &= ~LOCKLPM5;
UARTA0_PortPinSelection();
TimerA0_Configuration();
UARTA0_Configuration();
TimeStamp = LocalTime;
PrintfTimeStamp = LocalTime;
while(1)
{
TIMERA0_CLR;
__bis_SR_register(LPM0_bits | GIE);
if(LocalTime - TimeStamp >= 2000)
{ int i;
TerminalValue[0]= TvsVoltage;
TerminalValue[1]= TvsCurrent;
// Printf_USART2("Serial");
for(i =0; i<2 ; i++)
SendtheSequenceofbyte(TerminalValue[i]);
TimeStamp = LocalTime;
}
__delay_cycles(500);
}
}
void UARTA0_PortPinSelection(void)
{
P2SEL1 &= ~BIT0;
P2SEL0 |= BIT0;
P2SEL1 &= ~ BIT1;
P2SEL0 |= BIT1;
}
void UARTA0_Configuration(void)
{
// Configure UART
UCA0CTLW0 |= UCSWRST; // Put eUSCI in reset
UCA0CTLW0 |= UCSSEL__ACLK;
// Baud Rate calculation
UCA0BR0 = 3; // 32768/9600 = 3.4
UCA0MCTLW = 0x9200; // 1000000/115200 - INT(1000000/115200)=0.68
// UCBRSx value = 0xD6 (See UG)
UCA0BR1 = 0;
UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
UCA0IFG &=~ UCRXIFG;
// UCA0STATW |= UCLISTEN; // LOOP BACK
}
void TimerA0_Configuration(void)
{
TA0CCTL0 |= CCIE; // TACCR0 interrupt enabled
TA0CCR0 = 1000;
TA0CTL = TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, UP mode
}
void SendtheSequenceofbyte(char dataptr)
{
UCA0TXBUF = (dataptr & (short unsigned int)0x01FF);
while(!(UCA0IFG & UCTXIFG));
}
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
LocalTime++;
__bic_SR_register_on_exit(LPM0_bits);
}
#pragma vector=EUSCI_A0_VECTOR
__interrupt void EUSCI_A0_ISR(void)
{
static int count;
UCA0IFG &=~ UCRXIFG; // Clear interrupt
Data = (UCA0RXBUF & (short unsigned int )0x01FF);
P2OUT ^= BIT3;
if(flag ==0)
{
TempDta = (char)Data;
flag =1;
}
if(flag ==1)
{
if(count < 6)
{
RXTemp[count]= TempDta;
count++;
flag =0;
}
}
if(count >=6)
{
count=0;
flag=0;
}
// __bic_SR_register_on_exit(LPM0_bits);
}