Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21927

MSP430 UART

$
0
0

Hi to all,

          I am new for msp430, and i have gone through the register configuration config and sample code which is given ti website. Now i want to transmit a data from msp430 to pc through uart. But it is not happening in my program, I am attaching my code below. kindly let me know is there any mistake.

#include<msp430f5438a.h>

void main(void)
{
WDTCTL = WDTPW + WDTHOLD;

P5SEL |= BIT6 + BIT7; // TXD AND RXD
P1DIR |= BIT0;
P1OUT &= ~BIT0;

UCA1CTL1 |= UCSWRST; // ENABLE RESET
UCA1CTL1 |= UCSSEL_2; // CLOCK SELECTION SMCLK
UCA1BR0 = 9; // 1MHZ = 115200
UCA1BR1 = 0; // 1MHZ = 115200
UCA1MCTL |= UCBRS_1 + UCBRF_0;
UCA1CTL1 &= ~UCSWRST; // RELEASE RESET

UCA1IE = UCTXIE;
__bis_SR_register(LPM0_bits + GIE); // Enter LPM4, Enable interrupts

}

#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)

{
P1OUT ^= BIT0; // TOGGLE LED
while (!(UCA1IFG&UCTXIFG));
UCA1TXBUF = 0x01; // TX -> RXed character
}

thank you all...

 and my ultimate aim is to transfer the adc data to pc through uart. kindly give me some idea for that... thank you


Viewing all articles
Browse latest Browse all 21927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>