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.
Tool/software: TI C/C++ Compiler
HI Guys I want to control multiple MSP430 F5529 at the same time, so I set ID for them.
but there are some problem, If I use USB to power IC,my program can run normally.
But when I use DC power supply to power, RX's result of the return will be wrong.
So i hope some people can help me to solve, I will appreciate you, thanks.
I will post my test code, help me to check please.
This is first F5529's code
#include <msp430.h>
void DCO25MHzInit(void);
void TA0Init(void);
unsigned char counter;
unsigned long array[4];
unsigned char Ti_ID = 1;
unsigned char i;
unsigned char a;
unsigned char uartreceive(unsigned char *redata,unsigned char datalength)
{
while(datalength)
{
while(!(UCA0IFG & UCRXIFG ));
UCA1RXBUF = *redata;
redata++;
datalength--;
}
while(UCA1STAT & UCBUSY);
}
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
DCO25MHzInit();
TA0Init();
//UCA0CTL0 |= UCSWRST;
P3SEL |= BIT3+BIT4; // Enable RX & TX pin
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0xD9; // 25MHz/115200 = 217.01 = 0xD9
UCA0BR1 = 0x00; //
UCA0MCTL |= UCBRS_0 + UCBRF_0; //
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0MCTL |= UCBRS_1 + UCBRF_0; // Modulation UCBRSx=1, UCBRFx=0
UCA0IE |= UCRXIE;
UCA0IE |= UCTXIE;
_enable_interrupts();
}
#pragma vector=USCI_A0_VECTOR
__interrupt void one_uart_ISR(void)
{
for(i=0;i<4;i++)
{
if(counter = UCA0RXBUF)
{
uartreceive(array,4);
array[i] = counter;
}
}
if(Ti_ID = array[0])
{
UCA0TXBUF = 2;
a = UCA0TXBUF;
}
else
{
__asm(" NOP");
}
}
This is second F5529's code
#include <msp430.h>
void DCO25MHzInit(void);
void TA0Init(void);
unsigned char counter;
unsigned long array[4];
unsigned char Ti_ID2 = 2;
unsigned char i;
unsigned char a;
unsigned char uartreceive(unsigned char *redata,unsigned char datalength)
{
while(datalength)
{
while(!(UCA0IFG & UCRXIFG ));
UCA1RXBUF = *redata;
redata++;
datalength--;
}
while(UCA1STAT & UCBUSY);
}
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
DCO25MHzInit();
TA0Init();
P3SEL |= BIT3+BIT4; // Enable RX & TX pin
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0xD9; // 25MHz/115200 = 217.01 = 0xD9
UCA0BR1 = 0x00; //
UCA0MCTL |= UCBRS_0 + UCBRF_0; //
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0MCTL |= UCBRS_1 + UCBRF_0; // Modulation UCBRSx=1, UCBRFx=0
UCA0IE |= UCRXIE;
UCA0IE |= UCTXIE;
_enable_interrupts();
}
#pragma vector=USCI_A0_VECTOR
__interrupt void one_uart_ISR(void)
{
i = UCA0RXBUF;
if(Ti_ID2 = i)
{
UCA0TXBUF = 100;
a = UCA0TXBUF;
}
else
{
__asm(" NOP");
}
}
**Attention** This is a public forum