C51单片机的简单显示程序(有小数点)C语言程序
1个回答
展开全部
#include<reg51.h>
unsigned char code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40};//0-9
unsigned char time,sec=30,scanled;
unsigned char disdat[6]={1,2,3,4,5,6};
sbit keys=P1^0;
sbit keyc=P1^1;
sbit fmq=P3^0;
void t1isr() interrupt 3 //显示
{
TH1=0xec;
TL1=0x78;
P2=1<<scanled;
if(scanled==2)P0=~(ledtab[disdat[scanled]] | 0x80);
else P0=~ledtab[disdat[scanled]];
scanled++;
scanled%=6;
}
main()
{
TMOD=0x10;
TH1=0xec;
TL1=0x78;
TR1=1;
ET1=1;
EA=1;
while(1);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |