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

Joined
Sep 24, 2008
Messages
1
Reaction score
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;
}
}
}
:o

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:
 

Latest threads

Back
Top