Luniks
Newbie level 3
Hi everybody !
I am writing a UART code to communicate between a MSP430-F2350 and my PC and I have a problem with the Receive Interrupt Operation. This is my code :
When I send my ASCII array before to enter in LPM0 mode I receiced correctly the string "Hello !" on my PC with Hterm. But if I press a key .... no echo in Hterm !
Any ideas ? Thanks ...
I am writing a UART code to communicate between a MSP430-F2350 and my PC and I have a problem with the Receive Interrupt Operation. This is my code :
Code:
#include <msp430x23x0.h>
__interrupt void USCI0RX_ISR(void);
void main(void)
{
unsigned char Tab[7] = {0x48,0x65,0x6C,0x6C,0x6F,0x20,0x21}; // ASCII code
unsigned int i;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
P3DIR |= 0x40; // Set P3.6 to output direction
P3OUT |= 0x40; // P3.6 to high level (disabled UHF)
P3SEL |= 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0x68; // 1MHz : 9600 Bauds
UCA0BR1 = 0x00;
UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1
UCA0CTL1 &= ~UCSWRST; // Initialize USCI state machine
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
for (i=0; i<7; i++) //---- Sending Hello !
{
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF = Tab[i];
}
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
}
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF = UCA0RXBUF; // Sending the received character
}
When I send my ASCII array before to enter in LPM0 mode I receiced correctly the string "Hello !" on my PC with Hterm. But if I press a key .... no echo in Hterm !
Any ideas ? Thanks ...