欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標(biāo)題: 八路搶答器的單片機(jī)仿真與源碼 [打印本頁(yè)]

作者: 鴻仔仔丶    時(shí)間: 2018-3-16 10:44
標(biāo)題: 八路搶答器的單片機(jī)仿真與源碼
前陣子寫的練習(xí),程序仿真都在里面

仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)


單片機(jī)源程序如下:
  1. #include<reg51.h>
  2. #include"key.h"

  3. #define uchar unsigned char
  4. #define uint  unsigned int

  5. uchar number[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};


  6. void main()
  7. {       
  8.         uchar cloose,l;
  9.         uint o;
  10.         while(1)
  11.         {         
  12.          P0=0X00;
  13.          SPEAKER=1;
  14.          if(startkey()==1)                                   //檢測(cè)是否按下開始按鈕
  15.          {
  16.                  cloose=cloosekey();                          //檢測(cè)是否有違規(guī)情況
  17.                 if(cloose==0) continue;                  //無人違規(guī) 則返回
  18.                         else P0=number[cloose];                //有人違規(guī),顯示號(hào)碼
  19.                 while(endkey()==1);                         //蜂鳴器長(zhǎng)鳴
  20.                 for(o=0;o<500;o++)                               
  21.                 speaker();
  22.         //        while(endkey()==0);                       
  23.                                                          
  24.          }
  25.          else{P0=0x49;}                                        //顯示“三”提示開始搶答
  26.                  while(endkey()==1)
  27.                 {
  28.                         cloose=cloosekey();                 //檢測(cè)是否有選手搶答
  29.                         if(cloose!=0)
  30.                         {
  31.                                 P0=number[cloose];                   //顯示搶答選手號(hào)碼
  32.                                 for(l=0;l<150;l++)                                         
  33.                                 speaker();                                  //有選手搶答則蜂鳴器響                                                    
  34.                                 while(endkey()==1);
  35.                                 break;                                           //按下結(jié)束,本輪結(jié)束
  36.                         }
  37.                 }
  38.                        
  39.         }
  40. }

復(fù)制代碼

所有資料51hei提供下載:
八路搶答器.rar (54.64 KB, 下載次數(shù): 36)







歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1