在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > AVR128的程序——1602液晶顯示

            AVR128的程序——1602液晶顯示

            作者: 時間:2016-11-22 來源:網(wǎng)絡(luò) 收藏
            #include
            #define uchar unsigned char
            #define uint unsigned int
            unsigned char table[]="I love mcu!";
            unsigned char table1[]="very much!";
            #define rsout DDRB |= (1<<5)
            #define rsset PORTB |=(1<<5)
            #define rsclr PORTB &=~(1<<5)
            #define rwout DDRB |= (1<<6)
            #define rwset PORTB |= (1<<6)
            #define rwclr PORTB &= ~(1<<6)
            #define enout DDRB |= (1<<7)
            #define enset PORTB |= (1<<7)
            #define enclr PORTB &= ~(1<<7)
            void mcu_init(void);
            void Delayms(uint MS)
            {
            uint i,j;
            for( i=0;i
            for(j=0;j<1141;j++);
            }
            void write_com(uchar com)
            {
            rsclr;
            rwclr;
            enclr;
            PORTA=com;
            Delayms(5);
            enset;
            Delayms(5);
            enclr;
            }
            void write_data(uchar date)
            {
            rsset;
            rwclr;
            PORTA=date;
            Delayms(5);
            enset;
            Delayms(5);
            enclr;
            }
            void initlcd(void)
            {
            write_com(0x38);
            Delayms(5);
            write_com(0x01);
            Delayms(5);
            write_com(0x06);
            Delayms(5);
            write_com(0x0c);
            Delayms(5);
            }
            void main(void)
            {
            uint num=0;
            mcu_init();
            Delayms(30);
            initlcd();
            write_com(0x80);
            for(num=0;num<11;num++)
            {
            write_data(table[num]);
            Delayms(20);
            }
            write_com(0x80+0x40);
            for(num=0;num<10;num++)
            {
            write_data(table1[num]);
            Delayms(20);
            }
            while(1);
            }
            void mcu_init(void)
            {
            DDRA = 0XFF;
            PORTA = 0XFF;
            DDRC = 0XFF;
            PORTC = 0XFF;
            DDRF |= 0X0E;
            PORTF |= 0X0E;
            PORTF &= 0xF0;
            DDRB |= 0X10;
            PORTB |= 0X10;
            rsout;
            rwout;
            enout;
            }



            關(guān)鍵詞: AVR1281602液晶顯

            評論


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

            關(guān)閉