After all that it'd be great to know what the problem was, Glenn ;)
Bruce
> ok, got the UART working... ended up using some
example code from the TI
> website... i must have changed something in it before that stuffed up the
> initialization... but thanks for all your help on that one Hugh...
UART Initialization
Started by ●February 12, 2003
Reply by ●February 13, 20032003-02-13
Reply by ●February 13, 20032003-02-13
i can't really see what the problem was... i ended up creating a new project, and writing the code again & it worked.. perhaps it was something else apart from the code... but anyway, for future newbies trying to get the UART going, here's the code, most of it flogged from one of the c sample files: void usart0_init(void) //Clock sourceLK //Desired baud8400 //Actual baud8392 { UCTL0 = CHAR; // 8-bit character UTCTL0 = SSEL0; // UCLK = ACLK UBR00 = 0x45; // 8MHz 115200 UBR10 = 0x00; // 8MHz 115200 UMCTL0 = 0x2A; // 8MHz 115200 modulation ME2 |= UTXE0 + URXE0; // Enabled USART0 TXD/RXD IE2 |= 0x00;//UTXIE0; // Enabled USART0 RX interrupt P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD P3DIR |= 0x10; // P3.4 output direction } void Start_HFXtal(void) { char i; BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG) != 0); // OSCFault flag still set? BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) } void setup_watchdog() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT } void main(void) { unsigned int i; setup_watchdog(); // Set up the watchdog timer... Start_HFXtal(); usart0_init(); _EINT(); // Enable interrupts for (;;) { for (i=0;i<255;i++) { putchar(i); } } } -----Original Message----- From: Bruce Cannon [mailto:brucecannon@bruc...] Sent: Thursday, 13 February 2003 4:59 p.m. To: msp430@msp4... Subject: RE: [msp430] UART Initialization After all that it'd be great to know what the problem was, Glenn ;) Bruce > ok, got the UART working... ended up using some example code from the TI > website... i must have changed something in it before that stuffed up the > initialization... but thanks for all your help on that one Hugh... . ">http://docs.yahoo.com/info/terms/