Nho cac bac sua dum em doan code nay nhe:
#include <at89x51.h>
//Dia chi bo nho RAM
volatile unsigned char xdata *buf_rx = (char xdata *) 0x0000;
void delay(unsigned int n);
//Ham tre ms
void delay(unsigned int n)
{
unsigned int i,j;
for(i=0;i<n;i++)
for(j=0;j<125;j++);
}
void main(void)
{
unsigned char status, ch;
while(1)
{
ch = buf_rx[0]; //Doc data tu RAM
status = buf_rx [1];
}
}
#include <at89x51.h>
//Dia chi bo nho RAM
volatile unsigned char xdata *buf_rx = (char xdata *) 0x0000;
void delay(unsigned int n);
//Ham tre ms
void delay(unsigned int n)
{
unsigned int i,j;
for(i=0;i<n;i++)
for(j=0;j<125;j++);
}
void main(void)
{
unsigned char status, ch;
while(1)
{
ch = buf_rx[0]; //Doc data tu RAM
status = buf_rx [1];
}
}
Comment