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.
#include "msp430x54xA.h"
I'm trying to use the MSP430F5438A Experimenter Board with an XBee module through UART. I am using the example "UART code provide from T.I website. I have attached my code. I am using pins "P3 . 4,5 " for UART. I also added P10.6,7 for the (Clear to Send) and (Request to Send). I am trying to transmit a single character to another XBee module plugged directly into a desktop. I am not seeing anything in the terminal window of XCTU on the desktop for the other Xbee module. I'm thinking that my (Clear to Send) and (Request to Send) pins are not properly configure when the transmission start. Or it could possibly be that the RX and TX interrupt flags aren't properly configured. The baud rate is set to 9600. I know the processor sends a RTS and the XBee replies with a CTS. So would that be something that is internal or external? I don't think that is something that would be stored in the RXbuffer but at the sametime the processor is receiving a CTS so it has to store it some where? During the interrupt subroutine is the CTS or RTS supposed to toggle? I know RTS needs to be high and CTS needs to be low but is it constant?
Any guidance would be greatly appreciated !
main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// P10SEL |= 0x80; // Sets up pins for inputs or outputs
P10DIR |= 0x40; // Sets RTS (Request to Send) has a output
P10OUT |= 0x40; // Sets output high for P10.6
P10IN |= 0x80; // Sets CTS (Clear to Send) has a output
P3SEL |= 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 6; // 1MHz 9600 (see User's Guide)
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0, // over sampling
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE + UCTXIE; // Enable USCI_A0 RX interrupt
UCA0TXBUF = 0x40;
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
__no_operation(); // For debugger
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma
vector=USCI_A0_VECTOR
__interrupt
void USCI_A0_ISR(void)
{
switch(__even_in_range(UCA0IV,4))
{
case 0: break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
break;
case 4:
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
P10IN ^= 0x80;
UCA0TXBUF = 0x40; // TX -> RXed character
break; // Vector 4 - TXIFG
default: break;
}
}
**Attention** This is a public forum