1、基于51单片机篮球记分牌设计 基于51单片机篮球记分牌设计(数码管显示)#includeunsigned char a1,b1,c1,a2,b2,c2,d1,d2,e3,f3,g3,h3,i,j,flag10,flag11,flag12;unsigned char af,bf,time=24,cnt1,cnt2;signed int time1=720; sbit aj=P10;sbit bj=P11;sbit cn=P12;sbit bn=P13;sbit en=P32;sbit fn=P33;sbit hn=P30;sbit gn=P34;sbit set=P14;sbit tj=P15;
2、sbit tz=P16;sbit ot=P17;bit flag1=0,flag2=0,flag3=0,flag4=0,flag5=0,flag6,flag7,flag8,flag9;unsigned char s=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x7c,0x39,0x5e,0x79,0x3e;void delay(unsigned char i);void display();void sw();void abbfen();void esnny();void esnne();void esnns();void e
3、sfzw();void hfwz();void ot1();void setj ();void timej ();void timez ();void main()TMOD=0x11;TH0=0x3c;TL0=0xb0;TH1=0x3c;TL1=0xb0;EA=1;ET0=1;ET1=1;while(1) display(); abbfen(); sw(); esnny(); esnne(); esnns(); esnne(); esfzw(); hfwz(); timej (); timez (); setj (); ot1();void delay(unsigned char i )uns
4、igned char j,k;for (k=0;ki;k+)for (j=0;j10;j+);void display()a1=af/100;b1=af%100/10;c1=af%100%10;P2=0x00;P0=sa1;delay(2);P2=0x01;P0=sb1;delay(2);P2=0x02;P0=sc1;delay(2);P2=0x03;P0=s10;delay(2);a2=bf/100;b2=bf%100/10;c2=bf%100%10;P2=0x04;P0=s10;delay(2);P2=0x05;P0=sa2;delay(2);P2=0x06;P0=sb2;delay(2)
5、;P2=0x07;P0=sc2;delay(2);e3=time1/60/10;f3=time1/60%10;g3=time1%60/10;h3=time1%60%10;P2=0x08;P0=se3;delay(2);P2=0x09;P0=sf3;delay(2);P2=0x0a;P0=sg3;delay(2);P2=0x0b;P0=sh3;delay(2);d1=time/10;d2=time%10;P2=0x0c;P0=sd1;delay(2);P2=0x0d;P0=sd2;delay(2);void abbfen()if(aj=0)delay(10);if(aj=0)flag1=1;if
6、(flag1=1&aj=1)flag1=0;af+;void sw()if(bj=0)delay(10);if(bj=0)flag2=1;if(flag2=1&bj=1)flag2=0;bf+;void esnny()if(cn=0)delay(10);if(cn=0)flag3=1;if(flag3=1&cn=1)flag3=0;TR0=1;void esnne()if(bn=0)delay(10);if(bn=0)flag4=1;if(flag4=1&bn=1)flag4=0;TR0=0;void esfzw()if(en=0)delay (10);if(en=0) flag5=1; if
7、(flag5=1&en=1) flag5=0; TR1=1; void esnns()if (fn=0)delay (10);if(fn=0) flag6=1; if(flag6=1&en=1) flag6=0; TR1=0; void hfwz()if (gn=0)delay (10);if(gn=0) flag7=1; if(flag7=1&gn=1) flag7=0; time=24; void setj ()if (set=0)delay (10);if(set=0) flag10=1; if(flag10=1&set=1) flag10=0; j+; if (j=3) j=0; vo
8、id ot1()if (ot=0)delay (10);if(ot=0) flag12=1; if(flag12=1&ot=1) flag12=0; time1=300; void timej ()if (tj=0)delay (10);if(tj=0) flag8=1; if(flag8=1&tj=1) flag8=0; switch(j) case 0x00:break; case 0x01:time1-; break; case 0x02:time1=time1-60;break; default:break;void timez ()if (tz=0)delay (10);if(tz=
9、0) flag9=1; if(flag9=1&tz=1) flag9=0; switch(j) case 0x00:break; case 0x01:time1+; break; case 0x02:time1=time1+60;break; default:break;void int1()interrupt 1 TH0=0x3c; TL0=0xb0; cnt1+; if(cnt1=21) cnt1=0; time1-; if(time1=-1) time1=720; void int3()interrupt 3 TH1=0x3c; TL1=0xb0; cnt2+; if(cnt2=21) cnt2=0; time-; if(time=-1) time=24; hn=0; hn=1;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1