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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索

關(guān)于單片機(jī)密碼鎖*號顯示的一個(gè)簡單問題!

查看數(shù): 7593 | 評論數(shù): 15 | 收藏 0
關(guān)燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發(fā)布時(shí)間: 2018-5-2 18:00

正文摘要:

密碼鎖已經(jīng)編寫號,但有一個(gè)功能求助 我想實(shí)現(xiàn)這么一個(gè)功能,就是輸入密碼全是 * ,然后如果一直按下仿真中那個(gè)按鈕A,所有*號顯示成相應(yīng)的數(shù)字,這個(gè)功能一直沒實(shí)現(xiàn),求助應(yīng)該如何改寫程序? #include ...

回復(fù)

ID:420836 發(fā)表于 2020-5-4 00:41
謝謝您的幫助! 我學(xué)到很多
ID:324844 發(fā)表于 2020-5-3 22:49
我有一個(gè)問題,那個(gè)延時(shí)函數(shù)是怎么回事兒啊,如果認(rèn)為125是1ms,短延時(shí)只有8us,長延時(shí)是2.5ms,他的5ms延時(shí)有44ms,他的400ms延時(shí)是290ms,看不懂求問
ID:329641 發(fā)表于 2018-5-14 22:41
是不是定時(shí)器沒設(shè)定好?
ID:289777 發(fā)表于 2018-5-14 22:18

十分感謝
ID:213173 發(fā)表于 2018-5-6 17:15
haohaoxue51 發(fā)表于 2018-5-6 14:17
不行啊,帖子里沒有你的截圖。你發(fā)的這個(gè)改正程序我也試了,沒效果啊,K1按下后,在按鍵盤啥都不顯示,我 ...

這是改過的程序
  1. #include <REG52.h>
  2. #include<intrins.h>
  3. sbit K1=P1^2;
  4. sbit ALAM = P2^5;                                                                                                //報(bào)警        
  5. sbit open_led=P2^3;                                                                                                //開鎖指示燈        
  6. /*LCD接口定義*/
  7. sbit LcdRS   = P2^0;                                                                                      //lcd數(shù)據(jù)/命令選擇端  數(shù)據(jù)1命令0
  8. sbit LcdRW   = P2^1;                                                                                      //lcd讀/寫選擇端    讀1寫0
  9. sbit LcdEn   = P2^2;                                                                                      //lcd使能控制端  1有效
  10. sfr  LcdIO   = 0x80;                                                                                      //lcd數(shù)據(jù)接口 P0=0x80

  11. unsigned char code a[]={0xFE,0xFD,0xFB,0xF7};                                         //控盤掃描控制表
  12.                
  13. unsigned char countt0,second;                                                                        //t0中斷計(jì)數(shù)器,秒計(jì)數(shù)器
  14. unsigned char code start_line[]        = {"password:       "};
  15. unsigned char code name[]                  = {"===Coded Lock==="};                     //顯示名稱                 
  16. unsigned char code Error[]           = {"      error     "};                  //輸入錯(cuò)誤
  17. unsigned char code codepass[]        = {"      pass      "};
  18. unsigned char code LockOpen[]        = {"      open      "};                        //OPEN

  19. char InputData[6];                                                                                                //輸入密碼暫存區(qū)
  20. unsigned char CurrentPassword[6]={6,5,4,3,2,1};                                 //當(dāng)前密碼值
  21. unsigned char N=0;                                                                                                //密碼輸入位數(shù)記數(shù)
  22. unsigned char ErrorCont;                                                                                //錯(cuò)誤次數(shù)計(jì)數(shù)
  23. unsigned char KEY_SCAN,NUM;

  24. /****向LCD寫入命令或數(shù)據(jù)部分****/
  25. #define LCD_COMMAND         0         // 輸出指令
  26. #define LCD_DATA            1         // 輸出數(shù)據(jù)
  27. #define LCD_CLEAR_SCREEN    0x01      // 清屏指令
  28. #define LCD_HOME            0x02      // 光標(biāo)返回原點(diǎn)指令

  29. //=====================16us短延時(shí)==============================
  30. void Delay_short(unsigned int n)
  31. {
  32.          unsigned int i;
  33.          for(i=0;i<n;i++)     
  34.          {;}
  35. }
  36. //=====================長延時(shí)==============================
  37. void Delay_long(unsigned char N)
  38. {
  39.         unsigned char i;
  40.           unsigned int j;
  41.            for(i=0;i<N;i++)
  42.            {
  43.                 for(j=0;j<315;j++)  //一個(gè)循環(huán)16us,共5ms
  44.               {;}
  45.    }
  46. }
  47. //=====================5ms延時(shí)==============================
  48. void Delay5Ms(void)
  49. {
  50.         unsigned int TempCyc = 5552;
  51.         while(TempCyc--);
  52. }
  53. //===================400ms延時(shí)==============================
  54. void Delay400Ms(void)
  55. {
  56.          unsigned char TempCycA = 5;
  57.          unsigned int TempCycB;
  58.          while(TempCycA--)
  59.          {
  60.                   TempCycB=7269;
  61.                   while(TempCycB--);
  62.          }
  63. }

  64. /*寫LCD子程序                                          */
  65. /*入口參數(shù):數(shù)據(jù)style=1 指令, style=0 input:寫入的內(nèi)容*/

  66. void LCD_Write(bit style, unsigned char input)  
  67. {
  68.     LcdRS=style;         //數(shù)據(jù)style=1  指令style=0
  69.     LcdRW=0;             //寫
  70.     LcdIO=input;         //P0口輸出
  71.     Delay_short(10);     //延時(shí)
  72.     LcdEn=1;             //lcd使能
  73.     Delay_short(10);     //延時(shí)
  74.     LcdEn=0;             //停止
  75. }

  76. /****初始化LCD程序****/
  77. void LCD_Initial()
  78. {
  79.     Delay_long(6);                                     //延遲5*6=30ms
  80.     LCD_Write(LCD_COMMAND,0x38);                       //8位數(shù)據(jù)端口,2行顯示,5*7點(diǎn)陣
  81.     LCD_Write(LCD_COMMAND,0x38);
  82.     LCD_Write(LCD_COMMAND,0x38);                       //發(fā)送三遍
  83.     Delay_short(2);                                    //延遲大于39us
  84.     LCD_Write(LCD_COMMAND,0x0c);                            //顯示模式設(shè)置:開啟顯示, 無光標(biāo) 0x0c
  85.     Delay_short(2);                             //延遲大于39us
  86.     LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN);           //清屏                          0x01
  87.     Delay_short(100);                           //延遲大于1.53ms
  88.     LCD_Write(LCD_COMMAND,0x06);                               //輸入模式設(shè)置:AC遞增, 畫面不動(dòng) 0x06
  89. }


  90. /*液晶字符輸入的位置定位程序*/
  91. /*入口參數(shù):x范圍:0-15     y范圍:1,2*/
  92. void GotoXY(unsigned char x, unsigned char y)  
  93. {
  94.     unsigned char address;
  95.     if(y==1)
  96.         {
  97.         address=0x80+x;         //y=1顯示在第一行
  98.     }
  99.         else
  100.         {
  101.         address=0xc0+x;      //y=2顯示在第二行
  102.     }
  103.         LCD_Write(LCD_COMMAND, address);
  104. }

  105. /*將字符串輸出到液晶顯示函數(shù)*/
  106. /*入口參數(shù):字符串指針      */
  107. void Print(unsigned char *str)
  108. {
  109.     while(*str!='\0')
  110.     {
  111.         LCD_Write(LCD_DATA,*str);
  112.         str++;
  113.     }
  114. }
  115. //*********************************************************************
  116. //==============將按鍵值編碼為數(shù)值=========================
  117. unsigned char coding(unsigned char m)         
  118. {
  119.         unsigned char k;
  120.         switch(m)
  121.         {
  122. //                case (0x18): k=3;break;
  123. //                case (0x28): k=7;break;
  124. //                case (0x48): k='#';break;
  125. //                case (0x88): k='D';break;
  126.                 case (0x14): k=3;break;
  127.                 case (0x24): k=6;break;
  128.                 case (0x44): k=9;break;
  129.                 case (0x84): k='#';break;
  130.                 case (0x12): k=2;break;
  131.                 case (0x22): k=5;break;
  132.                 case (0x42): k=8;break;
  133.                 case (0x82): k=0;break;
  134.                 case (0x11): k=1;break;
  135.                 case (0x21): k=4;break;
  136.                 case (0x41): k=7;break;
  137.                 case (0x81): k='*';break;
  138.         }
  139.         return(k);
  140. }
  141. //=====================按鍵檢測并返回按鍵值===============================
  142. unsigned char keynum(void)
  143. {
  144.          unsigned char row,col,i;
  145.          P3=0xf0;
  146.          if((P3&0xf0)!=0xf0)
  147.          {
  148.                    Delay5Ms();
  149.               Delay5Ms();
  150.                    if((P3&0xf0)!=0xf0)
  151.                 {
  152.                     row=P3^0xf0;          //確定行線
  153.                         i=0;
  154.                         P3=a[i];                  //精確定位
  155.                         while(i<4)
  156.                         {
  157.                                  if((P3&0xf0)!=0xf0)
  158.                                   {
  159.                                            col=~(P3&0xff);          //確定列線
  160.                                            break;            //已定位后提前退出   
  161.                                   }
  162.                                 else
  163.                                   {
  164.                                            i++;
  165.                                            P3=a[i];
  166.                                   }
  167.                         }
  168.                 }
  169.                 else
  170.                 {                 
  171.                         return 0xff;        
  172.                 }
  173.                 while((P3&0xf0)!=0xf0);
  174.                 return (row|col);                         //行線與列線組合后返回
  175.          }
  176.          else
  177.         {
  178.                 return 0xff;                                 //無鍵按下時(shí)返回0xff
  179.         }
  180. }
  181. //***************************************************************************************/
  182. //=======================一聲提示音,表示有效輸入========================
  183. void OneAlam(void)
  184. {
  185.         unsigned char y;
  186.         for(y=0;y<30;y++)
  187.         {
  188.         ALAM=0;
  189.         Delay_short(50);
  190.           ALAM=1;
  191.         Delay_short(50);
  192.         }

  193. }

  194. //========================二聲提示音,表示操作成功========================
  195. void TwoAlam(void)
  196. {
  197.         OneAlam();
  198.         Delay5Ms();
  199.     ALAM=1;
  200.           Delay5Ms();
  201.         OneAlam();
  202.         Delay5Ms();
  203.     ALAM=1;
  204. }
  205. //========================三聲提示音,表示錯(cuò)誤========================
  206. void ThreeAlam(void)
  207. {
  208.         OneAlam();
  209.         Delay5Ms();
  210.     ALAM=1;
  211.         Delay5Ms();
  212.         OneAlam();
  213.         Delay5Ms();
  214.     ALAM=1;
  215.           Delay5Ms();
  216.         OneAlam();
  217.         Delay5Ms();
  218.     ALAM=1;
  219. }
  220. //=======================輸入密碼錯(cuò)誤超過三過,報(bào)警并鎖死鍵盤======================
  221. void Alam_KeyUnable(void)
  222. {
  223.         P3=0x00;
  224.         {
  225.                 OneAlam();
  226.                 Delay5Ms();
  227.             ALAM=1;
  228.                 Delay5Ms();
  229.         }
  230. }
  231. //=======================取消所有操作============================================
  232. void Cancel(void)
  233. {        
  234.         unsigned char i;
  235.         GotoXY(0,2);
  236.         Print(start_line);        
  237.         TwoAlam();                                //提示音
  238.         for(i=0;i<6;i++)
  239.         {
  240.                 InputData[i]=0;
  241.         }
  242.         ALAM=1;                                        //報(bào)警關(guān)
  243.         ErrorCont=0;                        //密碼錯(cuò)誤輸入次數(shù)清零
  244.         open_led=1;                                  //指示燈關(guān)閉
  245.         N=0;                                        //輸入位數(shù)計(jì)數(shù)器清零
  246. }
  247. //==========================確認(rèn)鍵,并通過相應(yīng)標(biāo)志位執(zhí)行相應(yīng)功能===============================
  248. void Ensure(void)
  249. {        
  250.         unsigned char i,j;
  251.         for(i=0;i<6;)
  252.         {                                       
  253.                 if(CurrentPassword[i]==InputData[i])
  254.                 {
  255.                         i++;
  256.                 }
  257.                 else
  258.                 {                        
  259.                         ErrorCont++;
  260.                         if(ErrorCont==3)                        //錯(cuò)誤輸入計(jì)數(shù)達(dá)三次時(shí),報(bào)警并鎖定鍵盤
  261.                         {
  262.                                 GotoXY(0,2);
  263.                                 Print("  KeypadLocked! ");
  264.                                 TR0=1;
  265.                                 do
  266.                                     Alam_KeyUnable();
  267.                                 while(TR0);
  268.                 return ;
  269.                         }
  270.             break;
  271.                 }
  272.         }

  273.         if(i==6)   //密碼正確輸入
  274.         {
  275.                         GotoXY(0,2);
  276.                         Print(codepass);
  277.                         Delay400Ms();
  278.                         Delay400Ms();
  279.                         GotoXY(0,2);
  280.                         Print(LockOpen);        
  281.                         TwoAlam();                                           //操作成功提示音
  282.                         //KEY_CLOCK=0;                                                                                        //開鎖
  283.                         //pass=1;                                                                                        //置正確標(biāo)志位
  284.                         open_led=0;                                                                                //開鎖指示燈亮
  285.                         for(j=0;j<6;j++)                                                                //將輸入清除
  286.                         {
  287.                                 InputData[i]=0;
  288.                         }
  289.                         while(1);
  290.         }
  291.         else
  292.         {
  293.         GotoXY(0,2);
  294.                 Print(Error);        
  295.                  ThreeAlam();                                                                                //錯(cuò)誤提示音
  296.         Delay400Ms();
  297.         GotoXY(0,2);
  298.                 Print(start_line);
  299.         for(j=0;j<6;j++)                                                                //將輸入清除
  300.                 {
  301.                         InputData[i]=0;
  302.                  }
  303.     }
  304.         N=0;                                                                                                        //將輸入數(shù)據(jù)計(jì)數(shù)器清零,為下一次輸入作準(zhǔn)備
  305. }

  306. void test_led()
  307. {
  308.         while(1)
  309.         {
  310.                 open_led=0;
  311.                 Delay400Ms();
  312.                 open_led=1;
  313.                 Delay400Ms();
  314.         }
  315. }

  316. void test_alarm()
  317. {
  318.     while(1)
  319.         {
  320.                 ALAM=1;
  321.                 Delay_short(60);
  322.                 ALAM=0;
  323.                 Delay_short(60);
  324.         }
  325. }
  326. void timer_init()
  327. {
  328.         TMOD=0x11;
  329.          TL0=0xB0;
  330.          TH0=0x3C;
  331.          EA=1;
  332.          ET0=1;        
  333.          TR0=0;
  334. }

  335. void test_key()
  336. {
  337.         unsigned char code ascii[]={"0123456789ABCDEF"};
  338.         KEY_SCAN=keynum();
  339.         if(KEY_SCAN!=0xff)
  340.         {
  341.                 GotoXY(0,1);
  342.                 Print("key_code:0x");
  343.                 LCD_Write(LCD_DATA, ascii[KEY_SCAN/16]);
  344.                 LCD_Write(LCD_DATA, ascii[KEY_SCAN%16]);
  345.         }
  346. }
  347. void keyscan()                                        //按鍵掃描程序
  348. {
  349.         static bit key_sign=0;        //按鍵自鎖標(biāo)志
  350.         static bit sign=0;
  351.         static unsigned char count=0;//計(jì)數(shù)變量                        
  352.         unsigned char i;
  353.         if(K1==0)                                        //檢測按鍵如果為0
  354.         {
  355.                 count++;                                        //消抖計(jì)數(shù)
  356.                 if((count>=250)&&(key_sign==0))
  357.                 {                        
  358.                         key_sign=1;                        //按鍵自鎖標(biāo)志置1
  359.                         sign=~sign;
  360.                         if(sign==1)
  361.                         {
  362.                                 for(i=0;i<N;i++)
  363.                                 {
  364.                                         GotoXY(9+i,2);
  365.                                         LCD_Write(LCD_DATA,InputData[i]+0x30);
  366.                                 }
  367.                         }
  368.                         else
  369.                         {
  370.                                 for(i=0;i<N;i++)
  371.                                 {
  372.                                         GotoXY(9+i,2);
  373.                                         LCD_Write(LCD_DATA,'*');
  374.                                 }
  375.                         }
  376.                 }
  377.         }
  378.         else                                                        //按鍵抬起
  379.         {
  380.                 key_sign=0;                                //按鍵自鎖標(biāo)志清0
  381.                 count=0;                                        //消抖計(jì)數(shù)清0
  382.         }
  383. }

  384. //==============================主函數(shù)===============================
  385. void main(void)
  386. {
  387.          
  388.         unsigned char j;
  389. //        test_led();
  390. //        test_alarm();
  391.          Delay400Ms();         //啟動(dòng)等待,等LCM講入工作狀態(tài)
  392.          LCD_Initial();         //LCD初始化

  393. //        while(1)
  394. //        {
  395. //                test_key();
  396. //        }

  397.         GotoXY(0,1);//日歷顯示固定符號從第一行第0個(gè)位置之后開始顯示
  398.         Print(name);//向液晶屏寫日歷顯示的固定符號部分
  399.         GotoXY(0,2);//時(shí)間顯示固定符號寫入位置,從第2個(gè)位置后開始顯示
  400.         Print(start_line);//寫顯示時(shí)間固定符號,兩個(gè)冒號
  401.         GotoXY(9,2);        //設(shè)置光標(biāo)位置
  402.         LCD_Write(LCD_COMMAND,0x0f);        //設(shè)置光標(biāo)為閃爍

  403. //        while(1);

  404.          P3=0xFF;
  405.         timer_init();



  406.          Delay5Ms(); //延時(shí)片刻(可不要)
  407.         N=0;                                                                                                                //初始化數(shù)據(jù)輸入位數(shù)
  408.          while(1)
  409.          {
  410.         if (!TR0)
  411.                 {
  412.                     KEY_SCAN=keynum();
  413.                 }
  414.         else
  415.                 {
  416.             KEY_SCAN = 0xff;
  417.         }

  418.                 if(KEY_SCAN!=0xff)
  419.                 {                                   
  420.                                         NUM=coding(KEY_SCAN);
  421.                                         switch(NUM)
  422.                                         {
  423.                                                 case 'A':         ;                                         break;
  424.                                                 case 'B':        ;                                     break;
  425.                                                 case 'C':         ;                                         break;
  426.                                                 case 'D':         ;                                        break;   
  427.                                                 case '*': Cancel();                                break;      //取消當(dāng)前輸入
  428.                                                 case '#': Ensure();                         break;           //確認(rèn)鍵,
  429.                                                 default:
  430.                                                 {        
  431.                                                         if(N<6)                                                           //當(dāng)輸入的密碼少于6位時(shí),接受輸入并保存,大于6位時(shí)則無效。
  432.                                                         {
  433. //                                                                  unsigned        char temp;
  434.                                                                 OneAlam();                                                                //按鍵提示音                                                
  435.                                                                 for(j=N;j<=N;j++)
  436.                                                                 {
  437.                                                                         GotoXY(9+j,2);
  438.                                                                         LCD_Write(LCD_DATA,'*');
  439.                                                                 }
  440. /*                                                           if(K1==0)
  441.                                                            {
  442.                                                                         GotoXY(9+N,2);
  443.                                                                         temp=NUM+0x30           ;
  444.                                                                         LCD_Write(LCD_DATA,temp);
  445.                                                                                                   
  446.                                                                 }*/
  447.                                                                 InputData[N]=NUM;
  448.                                                                 N++;
  449.                                                         }
  450.                                                         else                                                                                //輸入數(shù)據(jù)位數(shù)大于6后,忽略輸入
  451.                                                         {
  452.                                                                 N=6;
  453.                                                                  
  454.                                                         }
  455.                             break;
  456.                                                 }
  457.                                         }
  458.                         }
  459.                 keyscan();
  460.         }
  461. }

  462. //*********************************中斷服務(wù)函數(shù)**************************************
  463. void  time0_int(void) interrupt 1
  464. {
  465.          TL0=0xB0;
  466.          TH0=0x3C;
  467.          countt0++;
  468.           if(countt0==20)
  469.            {
  470.                 countt0=0;
  471.                 second++;
  472.                 if(second==10)
  473.                 {
  474.                                 P3=0xf0;
  475.                                 TL0=0xB0;
  476.                                  TH0=0x3C;
  477.                                 second=0;
  478.                                 ErrorCont=0;                        //密碼錯(cuò)誤輸入次數(shù)清零
  479.         GotoXY(0,2);
  480.                                 Print(start_line);
  481.         TR0=0;                                //關(guān)定時(shí)器
  482.                 }
  483.                         
  484.            }
  485. }
復(fù)制代碼

ID:289777 發(fā)表于 2018-5-6 14:17
wulin 發(fā)表于 2018-5-4 16:38
你這程序框架有缺陷,K1功能只能在矩陣鍵盤功能內(nèi)有效。

不行啊,帖子里沒有你的截圖。你發(fā)的這個(gè)改正程序我也試了,沒效果啊,K1按下后,在按鍵盤啥都不顯示,我的目的是輸入完密碼,它不是顯示*號嗎,按下K1后,所有*變?yōu)閷?yīng)的數(shù)字
ID:213173 發(fā)表于 2018-5-4 16:38
本帖最后由 wulin 于 2018-5-6 16:53 編輯
haohaoxue51 發(fā)表于 2018-5-3 14:04
具體如何設(shè)定呢,能寫一下嗎?在線等,拜托了

你這程序框架有缺陷,K1功能只能在矩陣鍵盤功能內(nèi)有效。目前只能單獨(dú)寫一個(gè)按鍵程序放在主循環(huán)中,刷新LCD顯示內(nèi)容。



ID:19715 發(fā)表于 2018-5-3 18:11
主程序里面的switch(NUM)不能相應(yīng)按鈕A,只有12個(gè)按鍵有按下才能執(zhí)行switch(NUM)
ID:289777 發(fā)表于 2018-5-3 17:36
感謝上面那位大佬的指點(diǎn),但是他的歷程顯示屏和我的這道題顯示不大一樣啊
請問我的如何改呢,有沒有人會(huì),拜托
ID:213173 發(fā)表于 2018-5-3 15:49

示例代碼
#include<reg51.h>
#define led P0
#define LED P2
sbit K1=P2^4;
unsigned int i=0,j=0;
unsigned char k=0,s=0;
bit sign=0;
unsigned char code LedChar[]=
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char code LedArr[]={0,1,2,3,4,5,6,7};
unsigned char LedBuff[9]={0,0,0,0,0,0,0,0,0x40};
void keyscan()                                        //按鍵掃描程序
{
        static bit key_sign=0;        //按鍵自鎖標(biāo)志
        static unsigned int count=0;//計(jì)數(shù)變量                       
        if(!K1)                                        //檢測按鍵如果為0
        {
                count++;                                        //消抖計(jì)數(shù)
                if((count>=100)&&(key_sign==0))
                {                       
                        key_sign=1;                        //按鍵自鎖標(biāo)志置1
                        sign=~sign;                        //顯示標(biāo)志取反
                }
        }
        else                                                        //按鍵抬起
        {
                key_sign=0;                                //按鍵自鎖標(biāo)志清0
                count=0;                                        //消抖計(jì)數(shù)清0
        }
}
void main()
{
        TMOD=0x01;
        TH0=0xb1;
        TL0=0xe0;
        TR0=1;
        while(1)
        {
                if(TF0==1)
                {
                        TF0=0;
                        TH0=0xb1;
                        TL0=0xe0;
                        s++;
                }
                if(s>=50)
                {
                        s=0;
                        i++;
                        if(i>9999)
                        {
                                i=0;
                                j++;
                                if(j>9999)
                                        j=0;
                        }
                }
/************數(shù)據(jù)分解到緩存************/
                LedBuff[0]=LedChar[j/1000];
                LedBuff[1]=LedChar[j%1000/100];
                LedBuff[2]=LedChar[j%100/10];       
                LedBuff[3]=LedChar[j%10];
                LedBuff[4]=LedChar[i/1000];
                LedBuff[5]=LedChar[i%1000/100];
                LedBuff[6]=LedChar[i%100/10];
                LedBuff[7]=LedChar[i%10];

                keyscan();//調(diào)用按鍵程序
/************8位數(shù)碼管顯示************/
                led=0x00;                        //消隱
                LED&=0xF8;                        //清除P2低3位,保留高5位狀態(tài)不變
                LED|=LedArr[k];        //送位碼
                if(sign==1)
                        led=LedBuff[8];        //送段碼*
                else
                        led=LedBuff[k];        //送段碼
                k++;
                if(k>=8)
                        k=0;
        }
}


ID:289777 發(fā)表于 2018-5-3 14:04
nbhmwj 發(fā)表于 2018-5-3 09:10
設(shè)定一個(gè)顯示緩存區(qū),保存輸入接收的密碼,當(dāng)檢測到按鈕A按下時(shí),調(diào)用顯示緩存區(qū)的值,否則顯示“*”

具體如何設(shè)定呢,能寫一下嗎?在線等,拜托了
ID:289777 發(fā)表于 2018-5-3 14:04
wulin 發(fā)表于 2018-5-2 20:23
可以設(shè)一個(gè)標(biāo)志,為0所有字符顯示“*”,為1所有字符正常顯示,這個(gè)標(biāo)志由按鈕A控制。

具體如何設(shè)定呢,能寫一下嗎?在線等,拜托了
ID:198543 發(fā)表于 2018-5-3 09:10
設(shè)定一個(gè)顯示緩存區(qū),保存輸入接收的密碼,當(dāng)檢測到按鈕A按下時(shí),調(diào)用顯示緩存區(qū)的值,否則顯示“*”
ID:289777 發(fā)表于 2018-5-2 21:50
跪求解答
ID:213173 發(fā)表于 2018-5-2 20:23
可以設(shè)一個(gè)標(biāo)志,為0所有字符顯示“*”,為1所有字符正常顯示,這個(gè)標(biāo)志由按鈕A控制。

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表