Motherboard Forums


Reply
Thread Tools Display Modes

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

 
 





















Junior Member
Join Date: Sep 2008
Posts: 1

 
      09-24-2008, 05:52 AM


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;
}
}
}


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))

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??????
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: OT: Best choice of 750GB hard drive William R. Walsh Dell 10 07-09-2008 07:39 PM


All times are GMT. The time now is 08:36 PM.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43