亲亲我的ZXC
亲亲我的ZXC
关注数: 68
粉丝数: 116
发帖数: 355
关注贴吧数: 94
大神们,显示程序,和定时中断程序分别是哪些谢谢 #include<reg51.h> unsigned char m=0;sec=0;msec=0;min=0; unsigned char aa_[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; unsigned char aa_1[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x79,0x00,0x10}; void T0_TNT(void) interrupt 3 { TH1=(65536-50000)/256; TL1=(65536-50000)%256; m++; if(m==2) { m=0; msec++; if(msec==10) { msec=0; sec++; if(sec==60) { sec=0; min++; if(min==10) min=0; } } } } void delay(unsigned char i) { unsigned char j,k; for(k=0;k<i;k++); for(j=0;j<255;j++); } void key() { unsigned char ctr; ctr=P3; ctr=ctr&0x07; if(ctr!=0) { if(ctr==0x06) TR1=1; if(ctr==0x05) TR1=0; if(ctr==0x03) { TR1=0; sec=0; min=0; msec=0; } } } void main() { TMOD=0x10; EA=1; ET1=1; TH1=(65536-50000)/256; TL1=(65536-50000)%256; while(1) { P2=0x01; P0=aa_[msec]; delay(10); P2=0x02; P0=aa_1[sec%10]; delay(10); P2=0x04; P0=aa_[sec/10]; delay(10); P2=0x08; P0=aa_1[min]; delay(10); key(); } }
1
下一页