第十篇
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| #include "reg51.h"
unsigned char miao=0; unsigned char led[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90} ;
void ZD1() interrupt 3 { static unsigned char count=0; TH1=(65536-50000)/256; TL1=(65536-50000)%256; count++; if(count>=20) { count=0; miao++; if(miao==100) { miao=0; } } }
void disp(unsigned char i) { unsigned int k;
P2=0xe7; P0=~led[i/10]; for(k=0;k<100;k++); P0=0X00;
P2=0xe3; P0=~led[i%10]; for(k=0;k<100;k++); P0=0X00;
} void main() {
TMOD=0x10; TH1=(65536-50000)/256; TL1=(65536-50000)%256;
ET1=1; EA=1;
TR1=1; while(1) { disp(miao); } }
|
代码下载链接(123云盘):https://www.123684.com/s/wFuijv-i8Zgh