标题: 单片机0~99数码管显示仿真与源码 [打印本页]

作者: 我是321    时间: 2018-3-14 14:10
标题: 单片机0~99数码管显示仿真与源码
0~99数码管代码及电路仿真图
仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)

单片机源程序如下:
  1. #include <REGX51.H>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. uchar DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  5. void delay(uint y)
  6. {
  7.      uchar j;
  8.      while(y--)for(j=0;j<120;j++);

  9. }
  10. void main()
  11. {
  12.         uchar j;
  13.         P0 = 0x00;
  14.         P2 = 0x00;
  15.         while(1){

  16.    for(j=0;j<=99;j++)

  17. {
  18.    P0 = DSY_CODE[j/10];
  19.    P2 = DSY_CODE[j%10];
  20.    delay(100);
  21. }

  22. }

  23. }
复制代码

所有资料51hei提供下载:
0~99数码管.zip (52.05 KB, 下载次数: 12)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1