|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2012-5-18 13:00:57
|
显示全部楼层
程序:#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[]=" I get";
uchar code table1[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0xc,39,0x5e,0x79,0x71};
uchar flag,a,i;
void init()
{
TMOD=0x20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
REN=1;
SM0=0;
SM1=1;
// SCON=0x50;
EA=1;
ES=1;
}
void main()
{ P1=0xf0;
P0=0x3f;
P2=0xff;
init();
while(1)
{
if(flag==1)
{ ES=0;
for(i=0;i<7;i++)
{
SBUF=table[i];
while(!TI);
TI=0;
}
SBUF=a;
while(!TI);
TI=0;
flag=0;
ES=1;
P0=table1[a];
}
}
}
void ser()interrupt 4
{
RI=0;
a=SBUF;
flag=1;
}
|
|