標(biāo)題: 單片機(jī)課程設(shè)計(jì)--電話按鍵lcd1602顯示 [打印本頁]

作者: yunbao    時(shí)間: 2017-5-17 19:55
標(biāo)題: 單片機(jī)課程設(shè)計(jì)--電話按鍵lcd1602顯示
#include<reg52.h>
#include<LCD1602.h>
#include<anjian.h>
#define uchar unsigned char

//****************************************************
//MS延時(shí)函數(shù)(12M晶振下測(cè)試)
//****************************************************
void Delay_ms(unsigned int m)
{
        unsigned int  i;
        unsigned long j;
        for(i = 0; i < m; i++)
                for(j = 0; j < 123; j++);
}

void main(){
         char key_data;
        Init_LCD1602();                                   //初始化LCD1602
        //LCD1602_write_com(0x80);         //指針設(shè)置到第一行第1列
   // Delay_ms(100);
        //LCD1602_write_word("  input telephone:");   //第一行顯示的
        L1602_string(1,1,"  4*4KeyBoard ");
        L1602_string(2,1,"Please Press key");
        while(1)
        {
                P2=0xf0;
                 if(P2!=0xf0){
                         Delay_ms(10);
                        if(P2!=0xf0)
                        {
                                 key_data=Keyscan();
                        }
                 }
        L1602_char(2,15,key_data/10+48);
        L1602_char(2,16,key_data%10+48);
        }
}






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