- #include <reg51.h>
- #define uint unsigned int
- #define uchar unsigned char
- uchar code smgduan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
- uchar n=0;
- uint i;
- void main()
- {
- TMOD|=0X20;
- TH1=0Xce;
- TL1=0Xce;
- ET1=1;
- EA=1;
- TR1=1;
- while(1);
- }
- void Timer1() interrupt 3
- {
- i++;
- if(i==20000)
- {
- i=0;
- P0=~smgduan[n++];
- if(n==10)
- {
- n=0;
- }
- }
- }
复制代码
|