这是我用我的 开发板写的一个0-9999计数器,你给个邮箱,我把原理图发给你,照片上传不了
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define dula P0
#define wela P2
uchar aa,qian,bai,shi,ge;
uint i;
void init();
void delay(uint z);
void display(uchar qian,uchar bai,uchar shi,uchar ge);
void shu(uchar qian,uchar bai,uchar shi,uchar ge) ;
uchar code num_table[]=
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
/*0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E , F */
void main()
{
init(); //初始化
i=0;
//wela=0xf0;//选择点亮的数码管
while(1)
{
if(aa==10)
{
aa=0;
if (i==9999)
i=0;
i++;
qian=i/1000;
bai=i%1000/100;
shi=i%100/10;
ge=i%10;
}
display(qian,bai,shi,ge);
}
}
void init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
void timer0()interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
aa++;
}
/*void shu(uchar qian,uchar bai,uchar shi,uchar ge)
{
qian=i/1000;
bai=i%1000/100;
shi=i%100/10;
ge=i%10;
} */
void display(uchar qian,uchar bai,uchar shi,uchar ge)
{
wela=0xef;
dula=num_table[qian];
P0=dula;
delay(1) ;
wela=0xdf;
dula=num_table[bai];
P0=dula;
delay(1) ;
wela=0xbf;
dula=num_table[shi];
P0=dula;
delay(1);
wela=0x7f;
dula=num_table[ge];
P0=dula;
delay(1) ;
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
2015468
笨怂!
我自己的毕设做到4位七段数码管动态显示系统设计,但是不知道你要的是哪一张语言,我的是FPGA语言实现