在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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)用 > 8051單片機操作K9KF5608 FLASH存儲器程序

            8051單片機操作K9KF5608 FLASH存儲器程序

            作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏
            //-----------------------函數(shù)聲明,變量定義--------------------------------------------------------
            #include
            #include
            #include
            #include
            sbit FLASH_CLE=P1^0;
            sbit FLASH_ALE=P1^1;
            sbit FLASH_WE=P1^2;
            sbit FLASH_WP=P1^3;
            sbit FLASH_CE=P1^4;
            sbit FLASH_RD=P1^5;
            sbit FLASH_RB=P1^6;
            void WriteCommand(unsigned char command);
            void WriteAddress(
            unsigned char H_ADR, //A16~A23 列地址
            unsigned char M_ADR, //A8~A15
            unsigned char L_ADR //A0~A7 行地址
            );
            void WRITEBYTE(unsigned char Wdata); //寫一個數(shù)據(jù)到FLASH
            unsigned char READBYTE(); //從FLSAH讀一個數(shù)據(jù)
            void REC_data_process(unsigned char Rdata); //接收adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=fbb35db267215cd4&k=%CA%FD%BE%DD%B4%A6%C0%ED&k0=%CA%FD%BE%DD%B4%A6%C0%ED&kdi0=0&luki=4&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=d45c2167b25db3fb&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1831118&u=http%3A%2F%2Fwww%2E51hei%2Ecom%2Fmcu%2F2168%2Ehtml&urlid=0" id="2_nwl" mpid="2" target="_blank">數(shù)據(jù)處理,讀一頁時,每讀一次處理一次
            void READ_onepage1(); //連續(xù)讀一頁數(shù)據(jù)(528字節(jié))
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: WriteCommand
            // 入口參數(shù): command命令字
            // 函數(shù)功能: 寫命令字,開始各種操作
            //--------------------------------------------------------------------------------------------------
            void WriteCommand(unsigned char command)
            {
            FLASH_ALE=0;
            FLASH_CE=0;
            FLASH_CLE=1;
            FLASH_WE=0;
            P0=command;
            FLASH_WE=1;
            FLASH_CLE=0;
            FLASH_ALE=1;
            }
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: WriteAddress
            // 入口參數(shù): H_ADR,M_ADR,L_ADR 行列地址
            // 函數(shù)功能: 寫地址
            //--------------------------------------------------------------------------------------------------
            void WriteAddress(
            unsigned char H_ADR, //A16~A23 列地址
            unsigned char M_ADR, //A8~A15
            unsigned char L_ADR //A0~A7 行地址
            )
            {
            FLASH_WE=1;
            FLASH_CE=0;
            FLASH_CLE=0;
            FLASH_ALE=1;
            FLASH_WE=0;
            P0=L_ADR;
            FLASH_WE=1;
            _nop_();
            FLASH_WE=0;
            P0=M_ADR;
            FLASH_WE=1;
            _nop_();
            FLASH_WE=0;
            P0=H_ADR;
            FLASH_WE=1;
            _nop_();
            FLASH_ALE=0;
            }
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: WRITEBYTE
            // 入口參數(shù): Wdata要寫入 FLASH的數(shù)據(jù)
            // 函數(shù)功能: 寫一個數(shù)據(jù)到FLASH
            //--------------------------------------------------------------------------------------------------
            void WRITEBYTE(unsigned char Wdata) //寫一個數(shù)據(jù)到FLASH
            {
            FLASH_WE=1;
            FLASH_CLE=0;
            FLASH_CE=0;
            FLASH_ALE=0;
            FLASH_WE=0;
            _nop_();
            P0=Wdata;
            _nop_();
            FLASH_WE=1;
            }
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: READBYTE
            // 出口參數(shù): Rdata從FLASH讀出的數(shù)據(jù)
            // 函數(shù)功能: 從FLSAH讀一個數(shù)據(jù)
            //--------------------------------------------------------------------------------------------------
            unsigned char READBYTE() //從FLSAH讀一個數(shù)據(jù)
            {
            unsigned char Rdata;
            FLASH_WE=1;
            FLASH_CLE=0;
            FLASH_ALE=0;
            FLASH_CE=0;
            FLASH_RD=0; //準(zhǔn)備好讀入
            _nop_();
            _nop_();
            while(!FLASH_RB)//當(dāng)讀信號無效時,等待
            {
            }
            Rdata=P0; //把P0口讀出的值存入ACC寄存器
            //插入2個機器周期
            _nop_();
            _nop_();
            FLASH_RD=1; //不再讀入
            return(Rdata);
            }
            unsigned char READ_Status()
            {
            unsigned char Status;
            WriteCommand(0x70);
            Status=READBYTE();
            return(Status);
            }
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: READ_onepage1
            // 調(diào)用函數(shù): WriteCommand
            // WriteAddress
            // REC_data_process();每接收一個數(shù)據(jù),處理
            // 函數(shù)功能: 連續(xù)讀一頁數(shù)據(jù)(528字節(jié))
            //--------------------------------------------------------------------------------------------------
            void READ_onepage1() //連續(xù)讀一頁數(shù)據(jù)(528字節(jié))
            {
            unsigned char d=528;
            unsigned char Rec_data;
            WriteCommand(0x00); //寫讀的命令0x00或0x01
            WriteAddress(0x00,0x00,0x00); //寫讀的地址
            while(d>0)
            {
            Rec_data=READBYTE();
            REC_data_process(Rec_data);
            d--;
            }
            FLASH_CE=1;
            }
            //--------------------------------------------------------------------------------------------------
            // 函數(shù)名稱: REC_data_process
            // 入口參數(shù): Rdata按頁讀時,每次讀回的數(shù)據(jù)
            // 函數(shù)功能:接收數(shù)據(jù)處理,讀一頁時,每讀一次處理一次
            //--------------------------------------------------------------------------------------------------
            void REC_data_process(unsigned char Rdata) //接收數(shù)據(jù)處理,讀一頁時,每讀一次處理一次
            {
            }


            評論


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

            關(guān)閉