在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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)用 > FFT算法在單片機(jī)中的使用&&LCD12864驅(qū)動

            FFT算法在單片機(jī)中的使用&&LCD12864驅(qū)動

            作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏

            void initw(); //初始化旋轉(zhuǎn)因子

            void bitReverse(); //比特反轉(zhuǎn)

            void FFT();

            complex x[N];

            uchar vis[N];

            void delayms(uint ms)

            {

            uint i,j;

            for(i=0;i{

            for(j=0;j<3;j++);

            }

            }

            //此處定義字符串

            //寫數(shù)據(jù)

            void WriteDataLCM(unsigned char WDLCM) //寫數(shù)據(jù)函數(shù)

            {

            // ReadStatusLCM(); //檢測忙

            delayms(1);

            PORTA|=RS; //RS=1

            delayms(1);

            PORTA&=~RW; //RW=0

            delayms(1);

            PORTA|=EN; //EN=1

            delayms(1);

            PORTB=WDLCM; //輸出數(shù)據(jù)

            delayms(1);

            PORTA&=~EN; //EN=0

            delayms(1);

            }

            //寫指令

            void WriteCommandLCM(unsigned char WCLCM) //寫命令函數(shù)

            {

            // ReadStatusLCM(); //根據(jù)需要檢測忙

            delayms(1);

            PORTA&=~RS; //RS=0

            delayms(1);

            PORTA&=~RW; //RW=0

            delayms(1);

            PORTA|=EN; //EN=1

            delayms(1);

            PORTB=WCLCM; //輸出指令

            delayms(1);

            PORTA&=~EN; //EN=0

            delayms(1);

            }

            //讀狀態(tài):檢測忙

            void ReadStatusLCM() //讀狀態(tài)函數(shù)

            {

            uchar temp;

            uchar flag = 1;

            while(flag==1)

            {

            PORTB=0xff;

            delayms(1);

            DDRB=0x00; //端口B改為輸入

            delayms(1);

            PORTA&=~RS; //RS=0

            delayms(1);

            PORTA|=RW; //RW=1

            delayms(1);

            PORTA|=EN; //EN=1

            delayms(10);

            temp = PINB; //讀端口B

            delayms(10);

            DDRB=0xff; //端口B改為

            delayms(10);

            PORTA&=~EN; //EN=0

            delayms(1);

            if(temp>>7==0)

            flag = 0;

            }

            }

            uchar read_data() //讀數(shù)據(jù)函數(shù)

            {

            uchar lcd_data;

            PORTB=0xff;

            DDRB=0x00;

            PORTA|=RW;

            PORTA|=RS;

            delayms(10);

            PORTA|=EN;

            delayms(10);

            lcd_data=PINB;

            delayms(10);

            PORTA&=~EN;

            DDRB=0xff;

            return(lcd_data) ;

            }

            void point(uchar x,uchar y) //打點(diǎn)函數(shù),最重要的函數(shù),GUI的基礎(chǔ)

            {

            uchar x_Dyte,x_byte;

            uchar y_Dyte,y_byte;

            uchar GDRAM_hbit,GDRAM_lbit;

            WriteCommandLCM(0x36);

            x_Dyte=x/16;

            x_byte=x&0x0f;

            y_Dyte=y/32;

            y_byte=y&0x1f;

            WriteCommandLCM(0x80+y_byte);

            WriteCommandLCM(0x80+x_Dyte+8*y_Dyte);

            read_data();

            GDRAM_hbit=read_data();

            GDRAM_lbit=read_data();

            delayms(10);

            WriteCommandLCM(0x80+y_byte);

            WriteCommandLCM(0x80+x_Dyte+8*y_Dyte);

            delayms(10);

            if(x_byte<8)

            {

            WriteDataLCM(GDRAM_hbit|(0x01<<(7-x_byte)));

            WriteDataLCM(GDRAM_lbit);

            }

            else

            {

            WriteDataLCM(GDRAM_hbit);

            WriteDataLCM(GDRAM_lbit|(0x01<<(15-x_byte)));

            }

            WriteCommandLCM(0x30);

            }

            //LCM初始化

            void LCMInit(void)

            {

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

            delayms(10);

            WriteCommandLCM(0x30);

            delayms(10);

            WriteCommandLCM(0x30);

            delayms(10);

            WriteCommandLCM(0x30); //顯示模式設(shè)置,開始要求每次檢測忙信號

            WriteCommandLCM(0x08); //關(guān)閉顯示

            WriteCommandLCM(0x01); //顯示清屏

            WriteCommandLCM(0x06); //顯示光標(biāo)移動設(shè)置

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

            }



            評論


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

            關(guān)閉