Other Parts Discussed in Thread: MSP430F2618
Hi,
I want to transfer a text file that contain few characters. i am using hyper-terminal to send this file to UART in receive mode. The below is the code:
#include <msp430f2618.h>
/*
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
if (CALBC1_1MHZ==0xFF) // If calibration constant erased
{
while(1); // do not load, trap CPU!!
}
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
P3OUT &= ~(BIT4+BIT5);
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 68; // 1MHz 115200
UCA0BR1 = 0; // 1MHz 115200
UCA0MCTL = UCBRS_1 + UCBRF_0; // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
__bic_SR_register_on_exit(LPM0_bits);
}
*/
//unsigned char *msg = "hello";
static unsigned char recv_file_data[17];
static unsigned int k=0;
int main(void)
{
unsigned int i;
WDTCTL = WDTPW + WDTHOLD;
if (CALBC1_1MHZ ==0xFF || CALBC1_1MHZ == 0xFF)
{
while(1); // If calibration constants erased
// do not load, trap CPU!!
}
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 8MHz
DCOCTL = CALBC1_1MHZ;
// Stop WDT
P3OUT &= ~(BIT4+BIT5);
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSSEL_2; // CLK = ACLK
UCA0BR0 = 0x08; // 1MHz/115200
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS_5 + UCBRF_0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits + GIE);
__no_operation();
__no_operation();
for(i = 0;i<17;i++)
{
UCA0TXBUF = recv_file_data[i];
while (!(IFG2&UCA0TXIFG));
}
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
recv_file_data[k++] = UCA0RXBUF;
//UCA0TXBUF = UCA0RXBUF;
__bic_SR_register_on_exit(LPM3_bits);
}
But i am not getting recv_file_data[] with the file content.
How can i check this it is hanging just after "__bis_SR_register(LPM3_bits + GIE);" line.
regards.