程序用软件keil打开,仿真用proteus软件打开。型号为7SEG-MPX8-CA-BLUE数码管显示仿真原理图:
单片机源程序:
- #include<reg51.h>
- #include<intrins.h>
- #define uchar unsigned char
- #define ulong unsigned long
- #define uint unsigned int
- uchar code DSY_CODE[]={0xa4,0xc0,0xf9,0x99,0xb0,0xc0,0xf8,0x99};
- uchar Digits[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
- void delay_us(void)
- {
- uint a,b;
- for(a=10;a>0;a--)
- for(b=10;b>0;b--)
- ;
- }
- void main()
- {
- uchar i;
- while(1)
- {
- for(i=0;i<8;i++)
- {
- P2=Digits[i];
- P0=DSY_CODE[i];
-
- delay_us();
- }
- }
- }
复制代码
下载:
Nixie light.rar
(38.86 KB, 下载次数: 53)
|