This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I want to take some string using UART and return the same back using interrupt. i am unable to write the proper programme. Also how to implement this code?
should I short TXD & RXD pins? Or should i use the USB to wire cable as shown in image?
Also help with the code.
#include <msp430.h> #include <driverlib.h> #include <msp430fr5969.h> volatile unsigned int i; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT PM5CTL0 &= ~LOCKLPM5; P4DIR |= BIT6; P1DIR |= 0x01; // All P1.x outputs P1OUT |= 0x01; P4OUT |= BIT6; P2SEL0 = 0x00;//(BIT5 + BIT6); P2SEL1 |= 0x60;//BIT5 + BIT6; UCA0CTL1 |= UCSSEL_1; // CLK = ACLK UCA0BR0 = 0x03; // 32kHz/9600 = 3.41 UCA0BR1 = 0x00; // UCA0MCTLW |= 0x0021;//UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3 UCA0IE |= 0x000F; UCA0CTL1 &= ~UCSWRST; UCA0TXBUF = '1'; __bis_SR_register(GIE);// __enable_interrupt(); } #pragma vector = USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) { switch(__even_in_range(UCA0IV,18)) {//here i toggeled leds just to see whether the interrupt has occured or not case 0x00: P1OUT ^= BIT0;//Vector 0: No interrupts break; case 0x02: P1OUT ^= BIT0;// Vector 2: UCRXIFG break; case 0x04: P4OUT ^=BIT6;// Vector 4: UCTXIFG break; case 0x06: P1OUT ^= BIT0;// Vector 6: UCSTTIFG break; case 0x08: P1OUT ^= BIT0;// Vector 8: UCTXCPTIFG break; default: break; } }
**Attention** This is a public forum