i wanna know how to calculate baud rate for my UART program

Discussion in 'Motherboard General Discussion' started by Manju, Sep 24, 2008.

  1. Manju

    Manju

    Joined:
    Sep 24, 2008
    Messages:
    1
    Likes Received:
    0
    this is what my program

    #include<reg51.h>

    void main()
    {
    unsigned char i = 0xAA;


    PCON |= 0x80; //Double the baud rate value
    SCON = 0x50; //REN enable & 8-bit uart enable
    TMOD = 0x02; //Select auto reload mode in timer 1
    TL1 = 0xA0; //Lower Byte
    TH1 = 0x96; //Upper Byte
    TR1=1; //enable timer

    while(1)
    {
    WDT_RST = 0xA1;

    if(TF1)
    TF1=0;

    if(TI)
    {
    TI=0;
    SBUF=i;

    }

    if(RI)
    {
    RI=0;
    value=SBUF;
    SBUF=value;
    }
    }
    }
    :eek:

    for this program i choose the baud rate by using the following formula which i came to know by manual.
    baudrate=((2^smod)32*Oscillator Frequency)/(24*(256-TH1)):cool:

    so what i need is i didnt get my output.i ve to get my AA value back in mt PC.so plz ll u help me what mistake i did in my program??????:cool:
     
    Manju, Sep 24, 2008
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.