serial interrupt in 8051

Status
Not open for further replies.

syedabutahir8

Newbie level 4
Joined
Jan 13, 2014
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
49
i have problem on this coding please anybody help me thanks in advance


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<reg51.h>
void main()
{
    TMOD = 0x20;
    TH1 = 0xfd;
    SCON = 0x50;
    TR1 = 1;
    IE = 0x90;
    while(1);
}
void ISR_sc() interrupt 4
{
    if(TI==1)
    {
        SBUF = 'A';
        TI = 0;
    }
    else
        RI = 0;
}



 
Last edited by a moderator:

try follow code

Code:
#include<reg51.h>
void delay(unsigned char del);


void main()
{
	SCON=0x52;
	TMOD=0x20;
	TH1=0xfd;
	TR1=1;
	EA = 1;
	ES = 1;
//    IE = 0x90;
  while(1)
	{
		SBUF = 's';
		delay(3);
	}
}


void ISR_sc() interrupt 4 using 1
{
    if(TI==1)
    {
        TI = 0;
    }
    else
        RI = 0;
}

void delay(unsigned char del)
{
	unsigned char i,j;
	for(i=0;i<del;i++)
		for(j=0;j<120;j++);
}
 

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…