在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > LCD1602幾種調(diào)試方法(NIOSii)

            LCD1602幾種調(diào)試方法(NIOSii)

            作者: 時(shí)間:2016-11-28 來(lái)源:網(wǎng)絡(luò) 收藏
            #include "system.h"

            #include

            本文引用地址:http://www.biyoush.com/article/201611/322944.htm

            int main (void)
            {
            FILE *lcd1;

            lcd1 = fopen("/dev/lcd", "w");

            if (lcd1 == NULL)
            printf("lcd not ready...n");
            else
            {
            printf("lcd ready...n");
            fprintf(lcd1, "111111111111111111111n");
            }

            fclose(lcd1);
            printf("can you see something?");

            return 0;
            }

            #include
            #include<altera_avalon_lcd_16207_regs.h>
            #include
            alt_u8 lcd_string1[] = "HELLO";
            alt_u8 lcd_string2[] = "2010";
            void check_busy() //讀液晶的忙標(biāo)志位并檢測(cè)
            {
            alt_u8 status;
            do
            {
            status=IORD_ALTERA_AVALON_LCD_16207_STATUS(LCD_BASE);
            }while(status&0x80);
            }
            void lcd_init() //液晶1602初始化
            {
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0x38); //功能設(shè)置
            check_busy();
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0x01); //清屏
            check_busy();
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0x06); //Y地址自動(dòng)加1模式
            check_busy();
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0x0c); //顯示開,不顯示光標(biāo)
            }

            void lcd_prints(alt_u8 *string) //打印字符串
            {
            while(*string!=)
            {
            check_busy();
            IOWR_ALTERA_AVALON_LCD_16207_DATA(LCD_BASE, *string);
            string++;
            }
            }
            void select_xy(alt_u8 x,alt_u8 y) //選擇屏幕坐標(biāo),x=0為第1行,x=1為第2行
            { //y=0~15,分別對(duì)應(yīng)第1列到第16列
            check_busy();
            if(x%2==0)
            {
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0x80+y);
            }
            else
            {
            IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, 0xc0+y);
            }
            }

            int main (void) __attribute__ ((weak, alias ("alt_main"))); //將程序的入口改為alt_main(),可以使
            //很多驅(qū)動(dòng)不會(huì)加載,可以大大減小代碼長(zhǎng)度
            void alt_main()
            {
            lcd_init();

            select_xy(0,0);
            lcd_prints(lcd_string1);

            select_xy(1,7);
            lcd_prints(lcd_string2);
            }

            ////////////

            #include
            #include "priv/alt_busy_sleep.h"
            #include "system.h"
            #include "altera_avalon_pio_regs.h"
            #include "alt_types.h"
            alt_u8 table[]="i love you";
            alt_u8 table1[]="www.renren.cn";
            void write_com(alt_u8 command)
            {
            IOWR_ALTERA_AVALON_PIO_DIRECTION(LCDDATA_BASE,0xff);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDDATA_BASE,command);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDRS_BASE,0);
            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDRW_BASE,0);
            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,0);

            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,1);
            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,0);
            alt_busy_sleep(5000);
            }
            void write_date(alt_u8 date)
            {


            IOWR_ALTERA_AVALON_PIO_DIRECTION(LCDDATA_BASE,0xff);
            IOWR_ALTERA_AVALON_PIO_DATA(LCDDATA_BASE,date);
            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDRS_BASE,1);
            alt_busy_sleep(5000);
            IOWR_ALTERA_AVALON_PIO_DATA(LCDRW_BASE,0);

            alt_busy_sleep(5000);
            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,0);


            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,1);

            alt_busy_sleep(5000);

            IOWR_ALTERA_AVALON_PIO_DATA(LCDE_BASE,0);

            alt_busy_sleep(5000);
            }
            void intit()
            {
            write_com(0x38);

            alt_busy_sleep(5000);
            write_com(0x0f);

            alt_busy_sleep(5000);
            write_com(0x06);

            alt_busy_sleep(5000);
            write_com(0x01);
            alt_busy_sleep(5000);
            write_com(0x80+0x02);

            }
            int main()
            {
            alt_u8 i;
            intit();
            for(i=0;i<10;i++)
            {
            write_date(table[i]);;
            alt_busy_sleep(5000);
            }
            write_com(0x80+0x41);
            for(i=0;i<14;i++)
            {
            write_date(table1[i]);;
            alt_busy_sleep(5000);
            }
            while(1);
            return 0;
            }



            關(guān)鍵詞: LCD1602調(diào)試方法NIOSi

            評(píng)論


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

            關(guān)閉