Hi,
does anyone have an idea, why the following program doesn't work?
I can send via RS232 to the mcu (because led4 toggles) but i don't receive the echo on my pc (i use hterm).
I connected also an osciloscope to UCA0TXD, but there is no chance of the signal while the mcu should send.
Please help me! :-)
#include <msp430.h>
void main(void) {
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF; // Configure load caps
do {
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
} while (IFG1 & OFIFG); // OSCFault flag still set?
P5DIR |= BIT1; // LED4
UCA0CTL1 |= UCSWRST;
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32k/9600 - 3.41
UCA0BR1 = 0x00; //
UCA0MCTL = 0x06; // Modulation
P2SEL |= BIT4 + BIT5;
P2DIR |= BIT4; // UCA0TXD as output ?!
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
_BIS_SR(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR (void) {
while(!(IFG2 & UCA0TXIFG)) {
__no_operation();
}
UCA0TXBUF = UCA0RXBUF + 1; // TX -> RXed character
P5OUT ^= BIT1; // toggle LED4 if character received
}