51单片机 4511 +BCD数码管显示+Proteus仿真

51单片机 4511 +BCD数码管显示+Proteus仿真


  • Proteus仿真图
    在这里插入图片描述
  • 4511真值表
    在这里插入图片描述

实例代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int

uchar code DSY_Index[] =
{
0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f
};
uchar code BCD_CODE[] =
{
0xf2,0x00,0XF2,0xf1,0xf1,0x00,0xf3,0xf1
};//2021 10 31

void DelayMS(uint ms)
{
uchar i;
while(ms--)
{
for(i=0;i<120;i++);
}
}

void main()
{
uchar k;
while(1)
{
for(k=0;k<8;k++)
{
P2 = DSY_Index[k];
P1 = BCD_CODE[k];
DelayMS(5);
P2 = 0XFF;
}
}
}

程序源码和仿真资源

1
2
3
链接:https://pan.baidu.com/s/1ig07GnJidOsXzl2SeKYkWA 
提取码:tqll