#include<reg51.h>
#define uchar unsigned char
uchar code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//0-9
uchar scanled;
void t1isr() interrupt 3 //显示
{
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
switch(scanled)
{
case 0:
P2=0x01;
P0=ledtab[0];
break;
case 1:
P2=0x80;
P0=ledtab[3];
break;
case 2:
P2=0x40;
P0=ledtab[5];
break;
case 3:
P2=0x20;
P0=ledtab[0];
break;
case 4:
P2=0x10;
P0=ledtab[6];
break;
case 5:
P2=0x08;
P0=ledtab[1];
break;
case 6:
P2=0x04;
P0=ledtab[0];
break;
case 7:
P2=0x02;
P0=ledtab[2];
break;
default:break;
}
scanled++;
scanled%=8;
}
main()
{
TMOD=0x10;
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
ET1=1;
TR1=1;
EA=1;
scanled=0;
while(1);
}
您好,有点抱歉-_-||好像现在不能上传图片了我就口述一下,然后就是需要显示的有8个数是20160530,仿真图就最最简单的那种,一个AT89C51单片机,一个8位7段显示管7SEG-MPX8-CC-BLUE,连线就P1.0到P1.7依次连数码管的A到DP,P2.0到P2.7依次连接的1到8
AT89C51单片机用8位7段显示管显示160530 求大佬帮忙给个c语言的程序
0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};\/\/0-9uchar scanled;void t1isr() interrupt 3 \/\/显示{ TH1=(65536-5000)\/256; TL1=(65536-5000)%256; switch(scanled) { case 0: P2=0x01; P0=ledtab[0];