分享一个51单片机用LED数码管来动态显示HELLO的proteus仿真下面是原理图:
单片机源程序:
- #include <reg51.h>
- #include <absacc.h>
- #define PA XBYTE[0XFF3C]
- #define PB XBYTE[0XFF3D]
- #define PC XBYTE[0XFF3E]
- #define PK XBYTE[0XFF3F]
- unsigned char code led[]={0x76,0x79,0x38,0x38,0x3f};
- unsigned char k[]={0xfe,0xfd,0xfb,0xf7,0xef};
- void delay(int n)
- {while(n--)
- {int i,j;
- for(i=0;i<10;i++)
- for(j=0;j<10;j++);
- }
- }
- void main()
- {PK=0X80;
- while(1)
- {int i;
- for(i=0;i<5;i++)
- {PA=led[i];
- PB=k[i];
- delay(10);
- PB=0XFF;
- }
- }
- }
复制代码
仿真工程文件及所有完整程序等资料下载地址(压缩包一共有45个单片机仿真,全部下载后找到第017个项目即可):
http://www.51hei.com/bbs/dpj-56298-1.html
|