LCD16X2 PASSWORD LOCK

Thảo luận trong 'Họ ARM'

Đang xem chủ đề này ( Thành viên: 0, Khách: 0)

  1. Trần Tài

    Trần Tài Học sinh trung cấp

    Tham gia ngày:
    6/11/14
    Bài viết:
    48
    Đã được thích:
    5
    Điểm thành tích:
    8
    Mọi người cho em hỏi về code (thuật toán) nhập ký tự vào LCD16x2 từ ma trận phím mà hiển thị liên tục các ký tự với! Em thử code rồi nhưng mãi không được!!!
    Ví dụ: bấm phím 1 thì hiện 1, bấm tiếp phím 2 thì sẽ thêm tiếp số 2 ngay sau số 1.....
    Em cám ơn rất nhiều ạ!
     
  2. TDM1

    TDM1 Học sinh phổ thông

    Tham gia ngày:
    25/9/16
    Bài viết:
    2
    Đã được thích:
    1
    Điểm thành tích:
    3
    bạn gửi code chưa được lên đây.
     
    Trần Tài thích bài này.
  3. Trần Tài

    Trần Tài Học sinh trung cấp

    Tham gia ngày:
    6/11/14
    Bài viết:
    48
    Đã được thích:
    5
    Điểm thành tích:
    8
    Em gửi code phần main, còn code full ở file dưới ạ!!! Em cám ơn!!!
    Mã:
    /**
      ******************************************************************************
      * Ten Tep        :            main.c
      * Tac Gia        :              Nguyen Quy Nhat
      * Cong Ty        :              MinhHaGroup
      *    Website     :              MinhHaGroup.com
      * Phien Ban    :              V1.0.0
      * Ngay          :            31-07-2012
      * Tom Tat   :       Dinh nghia ham main.                     
      *         
      *
      ******************************************************************************
      * Chu Y        :
      *                           
      ******************************************************************************
      */
    #include "main.h"
    #include "var.h"
    /*********************************EXTERN VARIABLE***********************************/
    int main(void)
    {
    /***********************************BIEN CUC BO*************************************/
    char str[20];
    uint8_t Key;
        int cursor = 192;
        int i = 0;
    /***********************************SYSTEM******************************************/
    SystemInit();
    
    /************************************NVIC*******************************************/
    //NVIC_Configuration();
                          
    /************************************GPIO*******************************************/
    GPIO_Configuration();
    
    /************************************TIMER*******************************************/
    //+++++++++++++++++++++++++++++++++++TIMER1+++++++++++++++++++++++++++++++++++++++++++
    //TIMER1_Configuration();
    
    //+++++++++++++++++++++++++++++++++++TIMER2+++++++++++++++++++++++++++++++++++++++++++
    //TIMER2_Configuration();
    
    //+++++++++++++++++++++++++++++++++++TIMER3+++++++++++++++++++++++++++++++++++++++++++
    //TIMER3_Configuration();  
    
    /************************************DMA********************************************/
    //+++++++++++++++++++++++++++++++++++DMA1+++++++++++++++++++++++++++++++++++++++++++
    //DMA1_Configuration();
    
    //+++++++++++++++++++++++++++++++++++DMA2+++++++++++++++++++++++++++++++++++++++++++
    //DMA1_Configuration();
    
    /************************************ADC********************************************/
    //++++++++++++++++++++++++++++++++++ADC1+++++++++++++++++++++++++++++++++++++++++++
    //ADC1_Configuration();
    
    //+++++++++++++++++++++++++++++++++ADC2+++++++++++++++++++++++++++++++++++++++++++
    //ADC2_Configuration();  
    
    //+++++++++++++++++++++++++++++++++ADC3++++++++++++++++++++++++++++++++++++++++++
    //ADC3_Configuration();
    
    /************************************USART********************************************/
    //+++++++++++++++++++++++++++++++++USART1++++++++++++++++++++++++++++++++++++++++++
    // USART1_Configuration();
      
    //+++++++++++++++++++++++++++++++++USART2++++++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++USART3++++++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++USART4++++++++++++++++++++++++++++++++++++++++++
    /****************************** USER FUNCITION *************************************/  
      delay_init(72);
        LCD_Init();
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     EXCUTION
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    
    /****************************************************************************
    ****************************************************************************/
    LCD_Puts("MinhHaGroup");
    LCD_Gotoxy(0,1);
    //LCD_Puts("BanLinhKien.Vn");
    while(1)
    {
         Key = KEY4X4_GetKey();
         //LCD_Gotoxy(0,1);
         for(i = 0; i < 3; i++)
            {
         if(Key)
         {
                sprintf(str,"%c",Key);
             //LCD_PutChar(Key);
                LCD_Gotoxy(0,1);
             LCD_SendCommand(cursor);
             cursor++;
           
                //LCD_Puts((uint8_t *)str);
                //while(Key)Key = KEY4X4_GetKey();
         }
          } 
    }
    }
    /******************* (C) COPYRIGHT 2012 Nguyen Quy Nhat *****END OF FILE****/
    
    
     

    Các file đính kèm:

Chia sẻ trang này