#include <reg52.h>
#define uint unsigned int
unsigned char a;
unsigned char b;
unsigned char table[2];
void Send(unsigned char *dis)
{
while(*dis!='\0')
{
SBUF=*dis;
dis++;
while(TI==0);
TI=0;
}
}
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void main(void)
{
TMOD=0x20;
SCON=0x50;
PCON=0x00;
TH1=0xfd;
TL1=0xfd;
TR1=1;
while(1)
{
table[0]=P1;
table[1]=P2;
Send(table);
delayms(100);
}
}
|