ronkpatell
Member level 5
- Joined
- Feb 2, 2012
- Messages
- 85
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- ahemdabad
- Activity points
- 1,894
#include <at89s53.h>
unsigned char xdata serial_buf=0;
void serial_interrupt( )interrupt 4 using 3
{
if( TI )
{
TI = 0;
//SBUF = 'A';
}
if( RI )
{
RI = 0;
serial_buf = SBUF;
SBUF = serial_buf;
}
}
void timer1_init(void)
{
SCON = 0X50;
TMOD = 0X20;
TH1 = 0XFD;
TR1 = 1;
TI = 1;
}
void main(void)
{
EA = 1;
ES = 1;
timer1_init();
while(1)
{
;
}
}
#include<at898252.h>
unsigned char xdata temp;
bit recv = 0, finish = 1;
void serial_int() interrupt 4 using 3
{
if(TI)
{
TI = 0;
if(finish)
return;
SBUF = temp;
finish = 1;
}
if(RI)
{
RI = 0;
finish = 0;
temp = SBUF;
recv = 1;
}
}
void main(void)
{
// IE = 0x90;
EA = 1;
ES = 1;
SCON = 0x5C;
TMOD = 0x20;
TH1 = 0xFA;
TL1 = 0xFA;
// T2CON = 0x30;
// T2MOD = 0x00;
// RCAP2H = 0xff;
// RCAP2L = 0xdc;//0xe6;
TR1 = 1;
while(1)
{
if(recv)
{
recv = 0;
TI = 1;
}
}
}
#include <at89s53.h>
unsigned char xdata serial_buf=0;
bit data_flag=0;
void serial_interrupt( )interrupt 4 using 3
{
if( TI )
{
TI = 0;
//SBUF = 'A';
}
if( RI )
{
RI = 0;
serial_buf = SBUF;
}
}
void main(void)
{
EA = 1;
ES = 1;
SCON = 0X50;
while(1)
{
if(data_flag)
{
data_flag = 0;
lcd_putchar(serial_buf);
}
}
}
#include <at89s53.h>
unsigned char xdata serial_buf=0;
bit data_flag=0;
void serial_interrupt( )interrupt 4 using 3
{
if( TI )
{
TI = 0;
SBUF = 'A';
}
if( RI )
{
RI = 0;
serial_buf = SBUF;
}
}
void main(void)
{
EA = 1;
ES = 1;
SCON = 0X50;
while(1)
{
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?