標題: 51單片機與7SEG-MPX8-CA-BLUE數(shù)碼管顯示數(shù)字 [打印本頁]

作者: 3443896565    時間: 2017-4-10 17:52
標題: 51單片機與7SEG-MPX8-CA-BLUE數(shù)碼管顯示數(shù)字
程序用軟件keil打開,仿真用proteus軟件打開。型號為7SEG-MPX8-CA-BLUE數(shù)碼管顯示仿真原理圖:


單片機源程序:

  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, 下載次數(shù): 53)

作者: LanYiBo    時間: 2018-7-9 10:28
非常感謝分享




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1