Hi, i am wondering how do you calculate the modulation for uart in the code below? this is an example code from AQ430. In another example using a 3.58Mhz at 9600 there was no modulation. i am using the MSP430F149. #include <msp430x14x.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT UCTL0 = CHAR; // 8-bit character UTCTL0 = SSEL0; // UCLK = ACLK UBR00 = 0x0D; // 32k/2400 - 13.65 UBR10 = 0x00; // UMCTL0 = 0x6B; // modulation ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD IE1 |= URXIE0; // Enable USART0 RX interrupt P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD P3DIR |= 0x10; // P3.4 output direction _EINT(); // Enable interrupts for (;;) { _BIS_SR(LPM3_bits); // Enter LPM3 _NOP(); // Required only for debugger } } interrupt[UART0RX_VECTOR] void usart0_rx (void) { while ((IFG1 & UTXIFG0) == 0); // USART0 TX buffer ready? TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 } Thanks in advance John
Calculating Modulation - uart
Started by ●April 28, 2006
Reply by ●April 29, 20062006-04-29
Check out: http://msp430.info/modules.php?name=Gadgets&op=uart Cheers, Rob johntran951 wrote: >Hi, >i am wondering how do you calculate the modulation for uart in the >code below? this is an example code from AQ430. In another example >using a 3.58Mhz at 9600 there was no modulation. i am using the >MSP430F149. > >#include <msp430x14x.h> > >void main(void) >{ > WDTCTL = WDTPW + WDTHOLD; // Stop WDT > UCTL0 = CHAR; // 8-bit character > UTCTL0 = SSEL0; // UCLK = ACLK > UBR00 = 0x0D; // 32k/2400 - 13.65 > UBR10 = 0x00; // > UMCTL0 = 0x6B; // modulation > ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD > IE1 |= URXIE0; // Enable USART0 RX interrupt > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > P3DIR |= 0x10; // P3.4 output direction > _EINT(); // Enable interrupts > > for (;;) > { > _BIS_SR(LPM3_bits); // Enter LPM3 > _NOP(); // Required only for debugger > } >} > >interrupt[UART0RX_VECTOR] void usart0_rx (void) >{ > while ((IFG1 & UTXIFG0) == 0); // USART0 TX buffer ready? > TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 >} > > >Thanks in advance >John > > > > > > >. > > >Yahoo! Groups Links > > > > > > > >
Reply by ●April 29, 20062006-04-29
Robert Reid napisa(a): > Check out: > http://msp430.info/modules.php?name=Gadgets>op=uart > > Cheers, > Rob > or http://mikrokontrolery.net/upi/ > johntran951 wrote: > > >Hi, > >i am wondering how do you calculate the modulation for uart in the > >code below? this is an example code from AQ430. In another example > >using a 3.58Mhz at 9600 there was no modulation. i am using the > >MSP430F149. > > > >#include >msp430x14x.h> > > > >void main(void) > >{ > > WDTCTL = WDTPW + WDTHOLD; // Stop WDT > > UCTL0 = CHAR; // 8-bit character > > UTCTL0 = SSEL0; // UCLK = ACLK > > UBR00 = 0x0D; // 32k/2400 - 13.65 > > UBR10 = 0x00; // > > UMCTL0 = 0x6B; // modulation > > ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD > > IE1 |= URXIE0; // Enable USART0 RX interrupt > > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > > P3DIR |= 0x10; // P3.4 output direction > > _EINT(); // Enable interrupts > > > > for (;;) > > { > > _BIS_SR(LPM3_bits); // Enter LPM3 > > _NOP(); // Required only for debugger > > } > >} > > > >interrupt[UART0RX_VECTOR] void usart0_rx (void) > >{ > > while ((IFG1 > UTXIFG0) == 0); // USART0 TX buffer ready? > > TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 > >} > > > > > >Thanks in advance > >John > > > > > > > > > > > > > >. > > > > > > > > > > > ---------------------------------- Poznaj Stefana! Zmien komunikator! >>> http://link.interia.pl/f1924