在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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>

            新聞中心

            25045操作標準子程序

            作者: 時間:2011-05-17 來源:網(wǎng)絡(luò) 收藏

            /*;*******************************************************
            *
            ;* Name: BYTE_WRITE
            ;* Description: Single Byte Write
            ;* Function: This routine sends the command to write a single byte to the EEPROM memory
            array
            ;* Calls: outbyt, wip_poll
            ;* Input: None
            ;* Outputs: None
            ;* Register Usage: A, B
            ;**********************************************************
            */
            /*字節(jié)寫入,aa為寫入的數(shù)據(jù),dd為寫入的地址,對于25045而言為000-1FF*/
            void byte_write(aa,dd)
            uchar aa;
            uint dd;
            {
            SCK=0;
            CS=0;
            outbyt((((uchar)(dd-0XFF))3)|WRITE_INST);/* Send WRITE instruction including MSB of address */
            /*將高位地址左移3位與寫入先導(dǎo)字相或,得到正確的先導(dǎo)字寫入25045*/
            outbyt((uchar)(dd));
            /*輸出低位地址到25045*/
            outbyt(aa);
            /*寫入數(shù)據(jù)到25045的對應(yīng)單元*/
            SCK=0;
            CS=1;
            wip_poll();
            /*檢測是否寫完*/
            }

            /*;********************************************************
            *
            ;* Name: BYTE_READ
            ;* Description: Single Byte Read
            ;* Function: This routine sends the command to read a single byte from the EEPROM memory
            array
            ;* Calls: outbyt, inputbyt
            ;* Input: None
            ;* Outputs: A = read byte
            ;* Register Usage: A, BXicor Application Note AN21
            ;********************************************************
            */
            /*字節(jié)讀出,其中dd為讀出的地址,返回的值為讀出的數(shù)據(jù)*/
            uchar byte_read(dd)
            uint dd;
            {
            uchar cc;
            SCK=0;
            CS=0;
            outbyt((((uchar)(dd-0XFF))3)|READ_INST);/* Send READ_INST instruction including MSB of address */
            /*將高位地址左移3位與讀出先導(dǎo)字相或,得到正確的先導(dǎo)字寫入25045*/
            outbyt((uchar)(dd));
            /*輸出低位地址到25045*/
            cc=inputbyt();/*得到讀出的數(shù)據(jù)*/
            SCK=0;
            CS=1;
            return cc;
            }


            /*;**********************************************
            *
            ;* Name: PAGE_WRITE
            ;* Description: Page Write
            ;* Function: This routine sends the command to write three consecutive bytes to the EEPROM
            ;* memory array using page mode
            ;* Calls: outbyt, wip_poll
            ;* Input: None
            ;* Outputs: None
            ;* Register Usage: A, B
            ;*****************************************************
            */
            /*頁面寫入,其中aa1,aa2,aa3,aa4為需要寫入的4個數(shù)據(jù)(最大也就只能一次寫入4個字,dd為寫入的首地址*/
            void page_write(aa1,aa2,aa3,aa4,dd)
            uchar aa1,aa2,aa3,aa4;
            uint dd;
            {
            SCK=0;
            CS=0;
            outbyt((((uchar)(dd-0XFF))3)|WRITE_INST);/* Send WRITE instruction including MSB of address */
            /*將高位地址左移3位與寫入先導(dǎo)字相或,得到正確的先導(dǎo)字寫入25045*/
            outbyt((uchar)(dd));
            /*寫入低位地址到25045*/
            outbyt(aa1);
            /*寫入數(shù)據(jù)1到25045的對應(yīng)單元*/
            outbyt(aa2);
            /*寫入數(shù)據(jù)2到25045的對應(yīng)單元*/
            outbyt(aa3);
            /*寫入數(shù)據(jù)3到25045的對應(yīng)單元*/
            outbyt(aa4);
            /*寫入數(shù)據(jù)4到25045的對應(yīng)單元*/
            SCK=0;
            CS=1;
            wip_poll();
            }


            /*;********************************************
            *
            ;* Name: SEQU_READ
            ;* Description: Sequential Read
            ;* Function: This routine sends the command to read three consecutive bytes from the EEPROM
            ;* memory array using sequential mode
            ;* Calls: outbyt, inputbyt
            ;* Input: None
            ;* Outputs: A = last byte read
            ;* Register Usage: A, B
            ;*********************************************************
            */
            /*連續(xù)讀出,由于函數(shù)的返回值只能為1個,對于連續(xù)讀出的數(shù)據(jù)只能使用指針作為函數(shù)的返回值才能做到返回一系列的數(shù)組*/
            /*sequ_read:*/
            unsigned int *page_read(n,dd)
            uchar n;/*n是希望讀出的數(shù)據(jù)的個數(shù),n=11*/
            unsigned int dd;/*dd是讀出數(shù)據(jù)的首地址*/
            {
            uchar i;
            uchar pp[10];
            unsigned int *pt=pp;
            SCK=0;
            CS=0;
            outbyt((((uchar)(dd-0XFF))3)|READ_INST);
            for (i=0;in;i++)
            {
            pp[i]=inputbyt();
            }
            return (pt);
            }
            /*調(diào)用的方法如下*/
            /*unsigned int *p;*/
            /*p=page_read(4,100);*/
            /*a=*(p)*/
            /*b=*(p+1)*/
            /*c=*(p+2)*/
            /*d=*(p+3)*/
            /*abcd中存放25045中由100地址開始的4個數(shù)據(jù)*/
            /* Send WRITE */
            /*mov DPTR, #PAGE_ADDR ; Set address of 1st byte to be read
            clr sck ; Bring SCK low
            clr cs ; Bring /CS low
            mov A, #READ_INST
            mov B, DPH
            mov C, B.0
            mov ACC.3, C
            lcall outbyt ; Send READ instruction with MSB of address
            mov A, DPL
            lcall outbyt ; Send low order address byte
            lcall inputbyt ; Read 1st data byte
            lcall inputbyt ; Read 2nd data byte
            lcall inputbyt ; Read 3rd data byte
            clr sck ; Bring SCK low
            setb cs ; Bring /CS high



            關(guān)鍵詞: 子程序 標準 操作

            評論


            相關(guān)推薦

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

            關(guān)閉