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

<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)用 > AVR單片機(jī)1602液晶程序

        AVR單片機(jī)1602液晶程序

        作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
        端口定義在程序里面采用8位數(shù)據(jù)模式,程序測試通過.
        #include
        #include
        #define uchar unsigned char
        #define uint unsigned int
        #pragma data:code
        uchar shu;
        const uchar table[15]={
        "yinqing@163.com"
        };
        const uchar table1[]={
        "www.51hei.com "
        };
        /**********************************/
        /************延時子程序************/
        /**********************************/
        void delay(uint z)//延時
        {
        uint x,y;
        for(x=500;x>0;x--)
        for(y=z;y>0;y--);
        }
        /**********************************/
        /***********寫指令子程序***********/
        /**********************************/
        void xeizhi(uchar tem)//寫指令子程序
        {
        PORTC&=~BIT(6);//將RS控制端置0
        PORTC&=~BIT(0);//將RW控制端置0
        delay(10);
        PORTA=tem;//將要讀的指令放到PA口
        PORTC|=BIT(0);//將使能端置0
        delay(10);
        PORTC&=~BIT(0);//將使能端置1
        }
        /**********************************/
        /************讀數(shù)子程序************/
        /**********************************/
        void duzhi(uchar tee)//寫數(shù)子程序
        {
        PORTC|=BIT(6);//將RS控制端置1
        PORTC&=~BIT(0);//將RW控制端置0
        delay(10);
        PORTA=tee;//將要讀的數(shù)放到PA口
        PORTC|=BIT(0);//將使能端置0
        delay(10);
        PORTC&=~BIT(0);//將使能端置1
        }
        /**********************************/
        /***************主程序*************/
        /**********************************/
        void main()
        {
        DDRA=0xff;
        DDRC|=BIT(6)|BIT(7)|BIT(0);//將3個控制端全部設(shè)為輸出
        PORTC&=~BIT(7);//將RW端置0
        xeizhi(0x01);
        xeizhi(0x38);
        xeizhi(0x0c);
        xeizhi(0x06);
        /*******************第一行顯示****************/
        xeizhi(0x80);//將數(shù)據(jù)放顯示區(qū)
        for(shu=0;shu<15;shu++)
        duzhi(table[shu]);
        /*******************第二行顯示****************/
        xeizhi(0xc0);//將數(shù)據(jù)放在顯示區(qū)
        for(shu=0;shu<15;shu++)//查詢15次得到要顯示的數(shù)
        duzhi(table1[shu]);//查表得到想要的數(shù),和上面結(jié)合妙妙??!
        while(1);
        }


        關(guān)鍵詞: AVR單片機(jī)1602液

        評論


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

        關(guān)閉