EmbeddedRelated.com
Forums

communication between two msp430 devices sing uart

Started by pari...@gmail.com February 11, 2009
Re-read message http://tech.groups.yahoo.com/group/msp430/message/40237

Michael K.

--- In m..., pariawe@... wrote:
>
> Hi friends
>
> Tintronic you are right about the possible cause of the problem
> i check SMCLK out so let me proclaim the guilty line
>
> FLL_CTL1=0X60;(located inside the setclk() function)
>
> i simply turn the SMCLK on and finally, happilly, suprisingly saw
the trasmition between two micro.
>
> thanks for your advice
>
> but a little snag there
>
> There is code for master micro. transmitter capture first interrupt
from the infinete loop(denoted as HERE HERE HERE) but unexpectedly it
never reverts to the main, i mean to the infinete loop. it stays
inside the interrupt till completion of the trasmission of "array ch"
>
> What about this?
>
> #include
> int count=0;char ch[]={'m',0X76,7};
> void setclk();
> void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD;
> setclk();
>
> P2SEL |= 0x30; // P2.4,5 = USART0 TXD/RXD
> ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD
> UCTL0 |= CHAR; // 8-bit character
> UTCTL0 |= SSEL1+TXWAKE; // UCLK = SMCLK
> UBR00 = 0x6D; // 1MHz 9600
> UBR10 = 0x00; //
> UMCTL0 = 0x03; // Modulation
> UCTL0 &= ~SWRST; // Initialize USART state machine
> IE1 |= UTXIE0; // Enable USART0 RX interrupt
> P2DIR |= 0x10; // P2.4 output direction
>
> _EINT();
> while(1){ } //HERE HERE HERE
> }
>
> #pragma vector=USART0TX_VECTOR
> __interrupt void usart0_tx (void)
> {
> //while (!(IFG1 & UTXIFG0));
> if(count<3)
> { TXBUF0 =ch[count++]; }
> }
>

Beginning Microcontrollers with the MSP430