找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

帖子
查看: 3994|回復(fù): 1
收起左側(cè)

基于51單片機(jī)密碼鎖設(shè)計(jì)LCD1602顯示(原理圖+程序)

[復(fù)制鏈接]
ID:260743 發(fā)表于 2019-3-26 10:09 | 顯示全部樓層 |閱讀模式
兄弟們加油!
電路原理圖如下:
0.png

單片機(jī)源程序如下:
  1. #include <reg52.h>
  2. #include <stdio.h>
  3. #include <intrins.h>
  4. #include "uart.h"
  5. #include "fpmxx.h"
  6. #include "lcd.h"
  7. #include "keyboard.h"
  8. #include "main.h"
  9. #include "eeprom.h"
  10. #include "12864.h"
  11. #include "led.h"
  12. #include "font.h"
  13. #include "password.h"


  14. sbit UART_RXD = P3^0;
  15. sbit UART_TXD = P3^1;
  16. sbit JIDIANQI = P3^7;


  17. volatile unsigned char Menu_Max_Item = 4;
  18. volatile unsigned char Menu_Select = 1;



  19. //測試?yán)^電器開工并關(guān)閉一次
  20. void Jidianqi_Test()
  21. {
  22.     JIDIANQI = 0;

  23.     Delay_Ms(100);

  24.     JIDIANQI = 1;
  25. }


  26. void main()
  27. {
  28.     unsigned char first = 1;
  29.     unsigned char ucKey = 0xFF;

  30.     Buzzer_On();
  31.     LED_Blink();
  32.     Jidianqi_Test();
  33.     LCD_Init();
  34.     UART_Init_57600();
  35.     Password_Init();
  36.        
  37.        
  38.     while(1)
  39.     {
  40.         if(first == 1)
  41.         {
  42.             FPMXX_Find_Fingerprint();
  43.             LCD_Main_Menu(1);
  44.             Menu_Select = 1;
  45.             first =2;
  46.         }

  47.         ucKey = getKeyPressed(); //掃描鍵盤輸入

  48.         if(ucKey == 11) //#
  49.         {
  50.             do
  51.             {
  52.                 ucKey = getKeyPressed();
  53.             }
  54.             while(ucKey != 11); //等待松開按鍵


  55.             switch(Menu_Select)
  56.             {

  57.             //查找指紋
  58.             case 1:


  59.                 FPMXX_Find_Fingerprint();
  60.                 LCD_Main_Menu(1);
  61.                 Menu_Select = 1;
  62.                 first =2;
  63.                 break;


  64.             //添加指紋
  65.             case 2:
  66.                 FPMXX_Add_Fingerprint();
  67.                 break;


  68.             //清空指紋
  69.             case 3:
  70.                 FPMXX_Delete_All_Fingerprint();
  71.                 break;


  72.             case 4:
  73.                 Change_Password();
  74.                 break;




  75.             }




  76.         }




  77.         if(ucKey == 8) //下
  78.         {
  79.             //  Delay_Ms(100);

  80.             do
  81.             {
  82.                 ucKey = getKeyPressed();
  83.             }
  84.             while(ucKey != 8); //等待松開按鍵


  85.             //當(dāng)前箭頭+1
  86.             if(Menu_Select!=Menu_Max_Item)
  87.             {
  88.                 Menu_Select++;

  89.             }

  90.             LCD_Main_Menu(Menu_Select);

  91.         }


  92.         if(ucKey == 2)   //上
  93.         {

  94.             do
  95.             {
  96.                 ucKey = getKeyPressed();
  97.             }
  98.             while(ucKey != 2); //等待松開按鍵


  99.             //當(dāng)前箭頭+1
  100.             if(Menu_Select!=1)
  101.             {
  102.                 Menu_Select--;

  103.             }

  104.             LCD_Main_Menu(Menu_Select);


  105.         }

  106.         Delay_Ms(100); //延時(shí)判斷100MS檢測一次




  107.     }
  108. }
復(fù)制代碼

所有資料51hei提供下載:
FPMXX_89C52RC_演示版資料.zip (197.02 KB, 下載次數(shù): 48)


回復(fù)

使用道具 舉報(bào)

ID:552896 發(fā)表于 2019-6-2 18:04 | 顯示全部樓層
謝謝大佬
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

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

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

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