Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

plz help.. its about serial communication

Status
Not open for further replies.

ami_20

Newbie level 2
Joined
Jan 7, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
mumbai
Activity points
1,298
hello guys...i am new to this forum...i saw many thread regarding serial communication betwwen pc and 8051 ..but it did not solve my problem.i want to send a string of 8 character continusly.and i m using interrupt here...in my program i want to display''we are in isr"on hyperterminal each time when isr is running...plz help me...here what i have done until now...its not workin and showing warning in printf ....


#include <REG51.H>
#include<stdio.h>
void send(unsigned char *);
sbit led=P1^0;
void inti_serialsetup();
unsigned char serialdata[]="ABCDEF";
void main()
{

inti_serialsetup();
send(serialdata);

while()
{
led=~led;
TH0=0XFF;
TL0=0X89;
TR0=1;
while(!TF0);
TF0=0;


}
}
void inti_serialsetup(void)
{

IE=0X90; //initialise serial interrupt
TMOD=0X21; //timer 0 in 16 bit and timer 1 in 8 bit mode
TH1=0XF6; //baud rate
SCON=0X50;
TR1=1;


}
void send(unsigned char *val)
{
unsigned char i=0;
for(i=0;i<7;i++)
{
SBUF=*val;

P1=SBUF;
val++;

}



}

void serialintrpt(void)interrupt 4
{
printf("\n we r in isr");
if(T1==1)
T1=0;
else
P1=SBUF;
RI=0;

}
:cry:
 

Hi ami_20, you can't use printf in interrupt function. Because printf needs much time to execute, this will let interrupt unnormal.
You just need to write your own printf function.
 

thanx for reply.......then hw to write it?can you plz tel me??and hw to send string using interrupt?????gv me a clue....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top