标题: 51单片机与7SEG-MPX8-CA-BLUE数码管显示数字 [打印本页]

作者: 3443896565    时间: 2017-4-10 17:52
标题: 51单片机与7SEG-MPX8-CA-BLUE数码管显示数字
程序用软件keil打开,仿真用proteus软件打开。型号为7SEG-MPX8-CA-BLUE数码管显示仿真原理图:


单片机源程序:

  1. #include<reg51.h>
  2. #include<intrins.h>
  3. #define uchar unsigned char
  4. #define ulong unsigned long
  5. #define uint unsigned int
  6. uchar code DSY_CODE[]={0xa4,0xc0,0xf9,0x99,0xb0,0xc0,0xf8,0x99};
  7. uchar Digits[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
  8. void delay_us(void)
  9. {
  10.         uint a,b;
  11.         for(a=10;a>0;a--)
  12.                         for(b=10;b>0;b--)
  13.                                 ;
  14. }       

  15. void main()
  16. {
  17.         uchar i;
  18.   while(1)
  19.         {
  20.                 for(i=0;i<8;i++)
  21.     {
  22.                         P2=Digits[i];
  23.                         P0=DSY_CODE[i];
  24.       
  25.                         delay_us();
  26.                 }  
  27.         }  
  28. }
复制代码




下载:
Nixie light.rar (38.86 KB, 下载次数: 53)

作者: LanYiBo    时间: 2018-7-9 10:28
非常感谢分享




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