新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > AVR 1602液晶字符移動

        AVR 1602液晶字符移動

        作者: 時間:2016-11-30 來源:網絡 收藏

        void delay(int k)
        {
        int i,j;
        for(i=0;i {
        for(j=0;j<1140;j++);
        }
        }
        void wait()
        {
        uchar val;
        DATA=0xff;
        RS=0;
        RW=1;
        __no_operation();
        __no_operation();
        EN=1;
        __no_operation();
        __no_operation();
        DDRA=0x00;
        val=PINA;
        while(val&busy)
        {
        val=PINA;
        }
        EN=0;
        DDRA=0xff;
        }

        void writecmd(uchar cmd)
        {
        wait();
        RS=0;
        RW=0;
        __no_operation();
        DATA=cmd;
        __no_operation();
        EN=1;
        __no_operation();
        __no_operation();
        EN=0;
        }
        void writedata(uchar data)
        {
        wait();
        RS=1;
        RW=0;
        __no_operation();
        DATA=data;
        __no_operation();
        EN=1;
        __no_operation();
        __no_operation();
        EN=0;
        }

        void displayonechar(uchar x,uchar y,uchar dda)
        {
        y&=0x01;
        x&=0x0f;
        if(y)x|=0x40;
        x|=0x80;
        writecmd(x);
        writedata(dda);
        }
        void displaychar(uchar x,uchar y,uchar *p)
        {
        y&=0x01;
        x&=0x0f;
        while(*p!= 主站蜘蛛池模板: 漯河市| 鄯善县| 龙陵县| 翁牛特旗| 兴文县| 海丰县| 五原县| 古丈县| 仙游县| 聂拉木县| 万安县| 崇州市| 颍上县| 枣庄市| 德格县| 民丰县| 澳门| 巴南区| 昌江| 徐水县| 通道| 丁青县| 施甸县| 重庆市| 通许县| 太和县| 石河子市| 澜沧| 岳普湖县| 民丰县| 万安县| 陇西县| 平顶山市| 抚顺县| 巫溪县| 湟中县| 牙克石市| 汝州市| 阳春市| 班戈县| 阳曲县|