Microcontroller basketball scorer program and simulation diagram

Publisher:中华古风Latest update time:2015-11-16 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Basic requirements
(1) Independently design the circuit required by the system according to the requirements of the topic, and complete the production and debugging of the hardware circuit.
(2) Be able to score normally in combination with the hardware
    (3) Be able to display the score normally.
    (4) Be able to modify the working mode normally
    (5) Be able to have an error of no less than 1 second in 24 seconds.
2. Performance part
  Be able to count the number of fouls committed by players of both teams.
 
3: Basic principles and reference block diagram
 
      The reference schematic diagram used in this topic is as follows: #include #define uchar unsigned char uchar code table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar code wei[]={0xfe,0xfd,0xfb,0xf7,0xef,0xbf,0xdf,0x7f}; uchar fen=0,miao=0,yi1=0,yi2=0,er1=0,er2=0; int a=0,flag=0,temp=0,temp1=0;fangui1=0,fangui2=0; sbit key1=P1^0; sbit key2=P1^1; sbit key3=P1^2; sbit key4=P1^3; sbit key5=P1^4; void delay(uchar z) { uchar i,j; for(i=z;i>0;i--) for(j=110;j>0;j--);  } void time01()//timer related { EA=1; TR0=1;//start timer 0 ET0=1;//start timer 0 interrupt TMOD=1; TH0=(65536-50000)/256; TL0=(65536-50000)%6;//statement: timing 50 milliseconds } display1(void) { P2=wei[0]; P0=table[fen]; delay(3); P2=wei[1]; P0=table[miao]; delay(3); P2=wei[2]; P0=table[fangui1]; delay(3); P2=wei[3]; P0=table[fangui2]; delay(3);  } display2() { P2=wei[0]; P0=table[yi2]; delay (3); P2=wei[1]; P0= table[ yi1 ]; delay(3) ; key1==0) { delay(10); if (key1==0) { flag=!flag; while(!key1); delay(4); } } } void jishu() { if ( key2 == 0 ) { delay ( 10 ) ; if ( key2 == 0) { delay(3) ; temp ++ ; yi1 =temp; yi2= temp/10; if(yi2==10) yi2=0; while (!key2); delay(4); } } if(key3==0 ) {  delay(10); if(key3==0) {  delay(3); temp++; er1=temp; er2=temp/10; if(er2==10) er2=0; while(!key3); delay(5); }  } if(key4==0) { delay(10); if(key4==0) {  delay(3); fangui1++; if(fangui1==10)fangui1=0; while delay(!key4); (5); } 
 
 
  Microcontroller basketball scorer program and simulation diagram


 











 
  
  
   
 


 
 
 
 
 
 



 
 
 
 
 
 
 
 
 
 
 
 



 
 
 
 
 
 
 
 
 
 
 
 



 
  
   
   
   
      
    
    
   
  
 



  
  
   
   
   
        
    
    
    
    
    
   
  
  
  
   
   
   
        
    
    
    
    
     
    
   
  
  
  
    
   
   
        
    
    
     
    
   
   
  }
  if(key5==0)
  {
   delay(10);
   if(key5==0)
   delay(3);
        fangui2++;
    if(fangui2==10) fangui2=0;
    while(!key5);
     delay(5);
   
 
  }
  
}
void main(void)
{
 time01();
 while(1)
 {
  keyboard();
  jishu();
  if(flag==1) display1();
  if(flag==0) display2();
  
 }
}

void time0() interrupt 1
 {
  TH0=(65536-50000)/256;
  TL0=(65536-50000)%6;
  a++;
  if(a==20)
  {
   a=0;
   miao++;
   if(miao==10)
   {
    miao=0;
    fen++; 
   }
   if(fen==2&&miao==5)
    {
     fen=0;miao=0;
    }
  }
 }
Keywords:MCU Reference address:Microcontroller basketball scorer program and simulation diagram

Previous article:MCU register group: Be careful of the danger of overwriting the original data when reusing it
Next article:Eight-way buzzer program and simulation

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号