Try putting the for(i... ) Loop around the crystal osc "do" loop and test.
The osc starts up, but stops as it is bouncing by the time you try to switch
to it, it has failed. This subject has been covered in just the last week,
so look back over the archive ...

Cheers
Harry

Home Phone(03) 9504 1957
Mobile                    0419 154 602

[email protected]




-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of helick
Sent: Friday, June 27, 2003 12:34 PM
To: [email protected]
Subject: [Mspgcc-users] more on clock source and UART

Hello again,

I am still having trouble with the serial communication portion of my
code.
From reading previous posts I composed the code bellow, which seems to be
correct, but the msp430f149 seems to have some peculiarities, so I am not
completely sure.

The code will hang on the clock initialization on both insight/gdb and
just running the thing on it's own power...I am pretty much out of ideas.

Please point out anything that might be wrong with this thing.

Thank you in advance.

helio

--------

void setup (void)
{
    unsigned int i;

    //port/pin setup for the specialCOMM
    P3DIR |= BIT4;
    P3SEL |= BIT4;              // Select pins to alternate function

    //clock setup
    BCSCTL1 |= 0x04;            //enable xtl2
    _BIC_SR(OSCOFF);
    do
    {
        IFG1 &= ~OFIFG;
        for(i = 255; i > 0; i--) __asm__ __volatile__("; loop");
    }
    while ((OFIFG & IFG1) != 0);
    BCSCTL2 = 0x88;

    //INITIALIZE serial port 0
    UCTL0 = CHAR | SWRST;       // 8 bit chars - leave in reset mode
    UTCTL0 = 0x20;              // uclk = smclk
    UBR10 = 0x01;               // 3.6864MHz/9600bps = 384 = 0x180
    UBR00 = 0x80;
    UMCTL0 = 0x00;
    ME1 |= UTXE0;               // Enable Tx0
    UCTL0 = CHAR;               // 8 bit chars - take out of reset

    IE1 |= UTXIE0;              //enable Tx0 interrupt

    eint();
}




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users


Reply via email to