[51] transfering data serially to pc with 89s51

Status
Not open for further replies.

usman ali butt

Newbie level 1
Joined
Aug 2, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
10
hi gies....
I am trying to transmit data serially to my pc throught hyperterminal... But i am unable to do so...
I am using 89s51 , Does 89s51 has buit in UART and can its timers capable of generating sufficient baud rate? On internet all the site's which have contents on serial data transfer , are using 89c51 series microcontrollers... Plz help me out....

Here is my code..


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<reg51.h>
 
void main()
{
char A[]="usman ali butt";
int i=0;
 
TMOD=0x20; // Timer1 Mode2 8 bit auto reload
TH1=0xFD; // 9600 bps
SCON=0x50; // 8 Data bit, 1 start bit, 1 stop bit 
TR1=1; // Timer1 ON
while(1)
{
while(A[i]!='\0'){
SBUF=A[i];
while(TI==0); // It automatically poles up to 1 when character is transmitted
TI=0;
i++;
                 }
i=0;
}
 
}



I am receiving garbage value on hyper terminal..... Does it mean something...
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…