八位数码管显示生日proteus设计图
时间: 2023-11-29 12:03:42 浏览: 210
以下是八位数码管显示生日的Proteus设计图及代码:
设计图:
![八位数码管显示生日Proteus设计图](https://img-blog.csdn.net/20180528163412909?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3N1bW1lcl9zaHVpeWFu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/q/75)
代码:
```c
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit LSA=P2^2;
sbit LSB=P2^3;
sbit LSC=P2^4;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,
0x7d,0x07,0x7f,0x6f,0x00
};
void delay(uint i)
{
while(i--);
}
void display(uchar i,uchar j)
{
LSA=0;LSB=0;LSC=0;P0=table[i];delay(100);
LSA=1;LSB=0;LSC=0;P0=table[j];delay(100);
}
void main()
{
uchar i,j,k;
TMOD=0x01;
TH0=0xfc;
TL0=0x18;
TR0=1;
while(1)
{
if(TF0==1)
{
TF0=0;
TH0=0xfc;
TL0=0x18;
k++;
if(k==20)
{
k=0; j++;
if(j==60)
{
j=0;
i++;
if(i==24)
{
i=0;
}
}
}
display(i,j);
}
}
}
```
阅读全文