<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 單片機電子密碼鎖子程序

          單片機電子密碼鎖子程序

          作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏

          仿真文件和完整源碼下載地址:http://www.51hei.com/bbs/dpj-22586-1.html
          論文下載地址:http://www.51hei.com/f/電子密碼鎖論文最終稿.docx
          下面是mima.c子程序:

          本文引用地址:http://www.ex-cimer.com/article/201611/323838.htm

          #include
          #include "mima.h"
          #include "1602.h"
          #include "adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=43258ce73f1bca35&k=%BE%D8%D5%F3&k0=%BE%D8%D5%F3&kdi0=0&luki=1&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=35ca1b3fe78c2543&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1831118&u=http%3A%2F%2Fwww%2E51hei%2Ecom%2Fmcu%2F2085%2Ehtml&urlid=0" id="5_nwl" mpid="5" target="_blank">矩陣鍵盤.h"
          #include "delay_ms.h"

          /*比較密碼函數(shù),密碼正確返回1,不正確返回0*/

          bitmimaduibi(unsigned char *string1,unsigned char *string2)
          {
          unsigned char count;
          for(count = 0; count < 6; count++)
          {
          if(string1[count] != string2[count])
          return 0;
          }
          return 1;
          }

          /*選擇輸入密碼或修改密碼函數(shù),輸入密碼返回A,修改密碼返回B*/

          unsigned char step_choose(void)//選擇輸入密碼或修改密碼處理函數(shù)
          {
          uchar key;
          key = 0xff;
          write_com(0x06);//寫一個字符后地址指針加 1
          write_com(0x01);//顯示清零,數(shù)據(jù)指針清零
          lcd_pos(0,0);
          write_n_char(" Input password ");
          lcd_pos(1,0);
          write_n_char(" Press key A ");
          while((key != A) && (key != B))
          key = keyscan();
          return key;
          }
          /*輸入密碼函數(shù),密碼正確返回1,錯誤返回0*/

          bitinput_mima(uchar * mima)//輸入密碼函數(shù)
          {
          unsigned char count,key;
          lcd_pos(1,0);
          for(count = 0; count < 7; count++)
          {
          delay_ms(100);
          if(count < 6)
          {
          do{key = keyscan();}//掃描鍵盤
          while(key == 0xff);
          if((key != backspace) && (key != A) && (key != enter))//不是退格也不是確認鍵
          {
          write_data(*);//是數(shù)字鍵顯示*
          mima[count] = key;
          //continue;
          }
          if(key == backspace)//是退格鍵
          {
          if(count > 0)
          {
          lcd_pos(1,--count);//光標前移一位
          write_data( );//清空一位
          mima[count] = ;//寫空
          lcd_pos(1,count);
          count--;//密碼計數(shù)器減一 ,因為循環(huán)后會+1,所以在這里要加1
          }
          }
          if(key == enter)//沒完成密碼輸入返回錯誤信息
          {
          lcd_pos(0,0);
          return(0);
          }
          }
          if(count==6)
          {
          do{key = keyscan();}
          while((key != backspace)&&(key != enter));
          if(key == backspace)
          {
          lcd_pos(1,--count);
          write_data( );
          mima[count]= ;
          lcd_pos(1,count);
          count--;
          }
          if(key == enter)//密碼位數(shù)正確
          {
          return(1);//返回1正確信號
          }
          }
          }

          }



          關(guān)鍵詞: 單片機電子密碼

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();