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.
Hi, i need help, i have a project, its using MSP430F149 to deal with smart home security system. what i need to do now is connect my MSP to my laptop using RS232 to usb through UART and do some simple communication first. But what i face now is i cant really save those character sent from my laptop. My board receiver buffer can only receive one byte once time, so when i try to sent one sentence from my laptop terminal to my board and try to save it in another variable which i declared, the character it saved very messy and i have no idea whats wrong with it. For example, i sent my phone number which like 0124363516 , then i move the number byte by byte from receiver buffer to a variable and then transmit by transmitter buffer to my laptop terminal to show whats inside, its come out like ( 11,22,465) smthin like that. im using IAR embedded workbench IDE and realterm as my terminal. Below are my coding, can i have some help??thanks alot.
include "io430.h"
#include <in430.h>
#include "nbc430.h"
#define uchar unsigned char
#define uint unsigned int
unsigned char s2;
unsigned char string2[] = { "Plesae Key In Your Message:\r\n" };
unsigned char s;
unsigned char string1[] = { "Please Key In Your Phone Number:\r\n" };
unsigned int i=0;
unsigned char buffer[];
void IO_init(void)
{
P3DIR4=1;P3DIR5=0;
}
void delay(uint time)
{
uint i,j;
for(i = 0;i < time; i++)
{
for(j = 0;j < 30; j++);
}
}
void init_com( void )
{
P3SEL |= 0x30;
ME1 |= UTXE0 + URXE0;
UTCTL0 = SSEL0;
UBR00 = 0x03;
UBR10 = 0x00;
UMCTL0 = 0x34;
UCTL0 |= CHAR;
UCTL0 &= ~SWRST;
IE1 |= URXIE0+UTXIE0;
IFG1&= ~UTXIFG0;
_EINT();
LPM3;
}
#pragma vector=UART0RX_VECTOR
__interrupt void usart0_rx (void)
{
while((IFG1&URXIFG0)==0);
buffer[count]=RXBUF0;
delay(1);
TXBUF0 =buffer[count];
count+=1;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
IO_init(); ¯
init_com( ) ;
while(1);
}
Where is count defined? Is it volatile?
Also, buffer needs to have a size defined.
**Attention** This is a public forum