中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 單片機液晶顯示代碼

        單片機液晶顯示代碼

        作者: 時間:2012-06-23 來源:網(wǎng)絡(luò) 收藏

        本文引用地址:http://www.antipu.com.cn/article/171260.htm

        //***************************************以下****************************************************

        void waitLcd() //just wait until 液晶不忙為止

        {

        char temp;

        bit flag=1;

        while(flag==1)

        {

        temp=XBYTE[rc];

        if (temp>>7==0) flag=0;

        P1=temp;

        }

        P1=0xff;

        }

        //just wait until 液晶不忙為止

        void WriteCommand_Lcd(bit isCheck,char c)

        {

        if (isCheck==1) waitLcd();

        XBYTE[wc]=c;

        }

        void writedata(char c)

        {

        waitLcd();

        XBYTE[wd]=c;

        }

        void LcdInit()

        {

        delay5ms();

        delay5ms();

        delay5ms();

        WriteCommand_Lcd(0,0x38); //三次顯示模式設(shè)置,不檢測忙信號

        delay5ms();

        WriteCommand_Lcd(0,0x38);

        delay5ms();

        WriteCommand_Lcd(0,0x38);

        delay5ms();

        WriteCommand_Lcd(1,0x38); //顯示模式設(shè)置,開始要求每次檢測忙信號,8位2行5*7

        WriteCommand_Lcd(1,0x08); //關(guān)閉顯示

        WriteCommand_Lcd(1,0x01); //清顯示

        WriteCommand_Lcd(1,0x06); // 文字不動,光標(biāo)右移

        WriteCommand_Lcd(1,0x0C); // 顯示開及光標(biāo)設(shè)置

        }

        void displayListChar(unsigned char X, unsigned char Y, uchar DData)

        {

        Y = 0x1;

        X = 0xF;

        if (X = 0xF)

        {

        Y = 0x1;

        X = 0xF;

        if (Y) X = 0x40;

        X = 0x80;

        WriteCommand_Lcd(0,X);

        writedata(dispbuf[DData]);

        }

        }

        //****************************************以上驅(qū)動*****************************************************

        //*************************************************

        //**********************************以下顯示時間*****************************************************

        void Show_Time(void)

        {

        displayListChar(0,0,hour/10);

        displayListChar(1,0,hour%10);

        displayListChar(2,0,10);

        displayListChar(3,0,minute/10);

        displayListChar(4,0,minute%10);

        displayListChar(5,0,10);

        displayListChar(6,0,second/10);

        displayListChar(7,0,second%10);

        }

        //**********************************以上顯示時間*****************************************************



        關(guān)鍵詞: 代碼 液晶顯示 單片機

        評論


        相關(guān)推薦

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

        關(guān)閉