- 22
- 0
- 约7.58千字
- 约 26页
- 2022-06-15 发布于贵州
- 举报
5
#includereg51.h
unsigned char SMG[]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6,0xee,0x3e,0x9c,0x7a,0x9e,0x8e,0x00};
unsigned int i,temp;
void aj()
{ P3=0x00;
if(P3^7==1)
{
temp++;
SBUF=temp;
while(TI==0)
TI=0;
temp=0xda;
}
}
void main()
{
P1=0x00;
SCON=0X50;
PCON=0X80;//波特率加倍
TMOD=0X20;//设定T1定时器工作方式2
TH1=0XF3;TL1=0XF3;//定义波特率的初值 24M 9600
TR1=1; //启动定时器1
ET1=0;
while(1)
{
P2 = 0x7F;
aj();
if( RI==1 )
{
RI = 0;
i = SBUF;
P0= SMG[i];//取值,数码管显示
SBUF = i;
}
}
}
6
#includereg51.h
unsigned char Tab[]={0xFC,0x60,0xDA,0xF2,0x66,0xB6,0xBE,0xE0,
0xFE,0xF6,0x
原创力文档

文档评论(0)